<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Auriga Portal - Sign In</title>
    <link rel="icon" type="image/png" href="<?= base_url('assets/images/auriga-logo.png') ?>">
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            height: 100vh;
            background: linear-gradient(135deg, #e0f2fe 0%, #dbeafe 50%, #e0e7ff 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
            position: relative;
            overflow: hidden;
        }

        body::before {
            content: '';
            position: absolute;
            width: 600px;
            height: 600px;
            background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
            top: -200px;
            right: -200px;
            border-radius: 50%;
            animation: float 20s ease-in-out infinite;
        }

        body::after {
            content: '';
            position: absolute;
            width: 500px;
            height: 500px;
            background: radial-gradient(circle, rgba(16, 185, 129, 0.12) 0%, transparent 70%);
            bottom: -150px;
            left: -150px;
            border-radius: 50%;
            animation: float 15s ease-in-out infinite reverse;
        }

        @keyframes float {
            0%, 100% {
                transform: translate(0, 0) scale(1);
            }
            33% {
                transform: translate(50px, -50px) scale(1.1);
            }
            66% {
                transform: translate(-30px, 30px) scale(0.9);
            }
        }

        .login-container {
            width: 100%;
            max-width: 460px;
            max-height: calc(100vh - 40px);
            overflow-y: auto;
            position: relative;
            z-index: 1;
            animation: slideIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
        }

        .login-container::-webkit-scrollbar {
            width: 6px;
        }

        .login-container::-webkit-scrollbar-track {
            background: transparent;
        }

        .login-container::-webkit-scrollbar-thumb {
            background: rgba(59, 130, 246, 0.3);
            border-radius: 3px;
        }

        .login-container::-webkit-scrollbar-thumb:hover {
            background: rgba(59, 130, 246, 0.5);
        }

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

        .login-card {
            background: #ffffff;
            border-radius: 28px;
            overflow: hidden;
        }

        .login-header {
            background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
            padding: 40px 40px 36px;
            text-align: center;
            color: white;
            position: relative;
            overflow: hidden;
        }

        .login-header::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 200%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
            animation: shimmer 3s infinite;
        }

        @keyframes shimmer {
            0% { left: -100%; }
            100% { left: 100%; }
        }

        .login-header .logo {
            width: 75px;
            height: 75px;
            background: rgba(255, 255, 255, 0.12);
            border-radius: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 18px;
            backdrop-filter: blur(10px);
            border: 2px solid rgba(255, 255, 255, 0.25);
            position: relative;
            z-index: 1;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2),
                        inset 0 1px 0 rgba(255, 255, 255, 0.3);
            transition: transform 0.3s ease;
        }

        .login-header .logo:hover {
            transform: scale(1.05);
        }

        .login-header .logo i {
            font-size: 36px;
            filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
        }

        .login-header h2 {
            font-size: 28px;
            font-weight: 700;
            margin-bottom: 8px;
            letter-spacing: -0.5px;
            position: relative;
            z-index: 1;
            text-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
        }

        .login-header p {
            font-size: 16px;
            opacity: 0.95;
            font-weight: 400;
            position: relative;
            z-index: 1;
            letter-spacing: 0.2px;
        }

        .login-body {
            padding: 36px 40px 32px;
        }

        .form-group {
            margin-bottom: 20px;
            animation: fadeInUp 0.6s ease backwards;
        }

        .form-group:nth-child(1) { animation-delay: 0.1s; }
        .form-group:nth-child(2) { animation-delay: 0.2s; }

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

        .form-group label {
            display: block;
            margin-bottom: 10px;
            color: #1e293b;
            font-weight: 600;
            font-size: 14px;
            letter-spacing: 0.3px;
        }

        .input-wrapper {
            position: relative;
        }

        .input-icon {
            position: absolute;
            left: 18px;
            top: 50%;
            transform: translateY(-50%);
            color: #64748b;
            transition: color 0.3s ease;
            font-size: 18px;
        }

        .toggle-password {
            position: absolute;
            right: 18px;
            top: 50%;
            transform: translateY(-50%);
            color: #64748b;
            cursor: pointer;
            transition: all 0.3s ease;
            font-size: 18px;
            padding: 4px;
            z-index: 10;
        }

        .toggle-password:hover {
            color: #3b82f6;
        }

        .toggle-password:active {
            transform: translateY(-50%) scale(0.9);
        }

        .form-control {
            width: 100%;
            height: 52px;
            padding: 14px 50px 14px 50px;
            border: 2px solid #e2e8f0;
            border-radius: 12px;
            font-size: 15px;
            transition: all 0.3s ease;
            background: #ffffff;
            color: #0f172a;
            font-weight: 500;
        }

        .form-control::placeholder {
            color: #94a3b8;
            font-weight: 400;
        }

        .form-control:focus {
            border-color: #3b82f6;
            background: white;
            box-shadow: 0 0 0 5px rgba(59, 130, 246, 0.08),
                        0 4px 20px rgba(59, 130, 246, 0.12);
            outline: none;
        }

        .form-control:focus ~ .input-icon {
            color: #3b82f6;
        }

        .btn-login {
            width: 100%;
            height: 54px;
            background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
            border: none;
            border-radius: 14px;
            color: white;
            font-weight: 700;
            font-size: 16px;
            cursor: pointer;
            transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
            margin-top: 8px;
            box-shadow: 0 6px 24px rgba(59, 130, 246, 0.3),
                        inset 0 1px 0 rgba(255, 255, 255, 0.15);
            position: relative;
            overflow: hidden;
            letter-spacing: 0.5px;
            animation: fadeInUp 0.6s ease 0.3s backwards;
        }

        .btn-login::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
            transition: left 0.6s;
        }

        .btn-login:hover::before {
            left: 100%;
        }

        .btn-login:hover {
            transform: translateY(-3px);
            box-shadow: 0 12px 32px rgba(59, 130, 246, 0.4),
                        inset 0 1px 0 rgba(255, 255, 255, 0.2);
        }

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

        .btn-login i {
            margin-right: 8px;
            font-size: 18px;
        }

        .demo-credentials {
            margin-top: 24px;
            margin-bottom: -4px;
            padding: 20px;
            background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
            border-radius: 14px;
            border: 2px solid #e2e8f0;
            animation: fadeInUp 0.6s ease 0.4s backwards;
        }

        .demo-credentials h6 {
            color: #1e40af;
            font-weight: 700;
            margin-bottom: 14px;
            font-size: 13px;
            text-transform: uppercase;
            letter-spacing: 1px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .demo-credentials h6::before {
            content: '🔑';
            font-size: 16px;
        }

        .credential-item {
            background: white;
            padding: 12px 16px;
            border-radius: 10px;
            margin-bottom: 10px;
            display: flex;
            align-items: center;
            gap: 12px;
            border: 1px solid #e2e8f0;
            transition: all 0.3s ease;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
        }

        .credential-item:last-child {
            margin-bottom: 0;
        }

        .credential-item:hover {
            border-color: #3b82f6;
            box-shadow: 0 4px 16px rgba(59, 130, 246, 0.12);
            transform: translateX(4px);
        }

        .credential-badge {
            padding: 6px 12px;
            border-radius: 8px;
            font-size: 11px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            flex-shrink: 0;
        }

        .badge-admin {
            background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
            color: white;
            box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
        }

        .badge-user {
            background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
            color: white;
            box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
        }

        .credential-text {
            display: flex;
            gap: 12px;
            font-family: 'Courier New', monospace;
            font-size: 13px;
            font-weight: 600;
            color: #334155;
            flex: 1;
        }

        .credential-text span {
            color: #64748b;
        }

        .login-footer {
            margin-top: 24px;
            text-align: center;
            color: #64748b;
            font-size: 14px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }

        .login-footer i {
            font-size: 16px;
            color: #64748b;
        }

        /* Responsive Design */
        @media (max-width: 768px) {
            body {
                padding: 16px;
            }

            body::before,
            body::after {
                width: 400px;
                height: 400px;
            }

            .login-container {
                max-width: 100%;
            }

            .login-header {
                padding: 40px 28px 36px;
            }

            .login-header .logo {
                width: 80px;
                height: 80px;
            }

            .login-header .logo i {
                font-size: 38px;
            }

            .login-header h2 {
                font-size: 30px;
            }

            .login-header p {
                font-size: 15px;
            }

            .login-body {
                padding: 36px 28px 32px;
            }

            .form-group {
                margin-bottom: 20px;
            }

            .form-control {
                height: 54px;
                font-size: 14px;
                padding: 14px 16px 14px 48px;
            }

            .input-icon {
                left: 16px;
                font-size: 17px;
            }

            .btn-login {
                height: 56px;
                font-size: 15px;
            }

            .demo-credentials {
                padding: 20px;
                margin-top: 28px;
            }

            .credential-item {
                padding: 14px 16px;
            }

            .credential-text {
                font-size: 12px;
            }

            .login-footer {
                font-size: 13px;
                margin-top: 28px;
            }
        }

        @media (max-width: 576px) {
            body {
                padding: 12px;
            }

            body::before,
            body::after {
                width: 300px;
                height: 300px;
            }

            .login-card {
                border-radius: 24px;
            }

            .login-header {
                padding: 36px 24px 32px;
            }

            .login-header .logo {
                width: 75px;
                height: 75px;
                border-radius: 20px;
            }

            .login-header .logo i {
                font-size: 36px;
            }

            .login-header h2 {
                font-size: 26px;
                margin-bottom: 8px;
            }

            .login-header p {
                font-size: 14px;
            }

            .login-body {
                padding: 32px 24px 28px;
            }

            .form-group {
                margin-bottom: 18px;
            }

            .form-group label {
                font-size: 13px;
                margin-bottom: 8px;
            }

            .form-control {
                height: 52px;
                font-size: 14px;
                padding: 12px 14px 12px 46px;
                border-radius: 12px;
            }

            .input-icon {
                left: 15px;
                font-size: 16px;
            }

            .btn-login {
                height: 54px;
                font-size: 15px;
                border-radius: 12px;
            }

            .btn-login i {
                font-size: 16px;
            }

            .demo-credentials {
                padding: 18px;
                margin-top: 24px;
                border-radius: 14px;
            }

            .demo-credentials h6 {
                font-size: 12px;
                margin-bottom: 16px;
            }

            .demo-credentials h6::before {
                font-size: 14px;
            }

            .credential-item {
                padding: 13px 14px;
                border-radius: 10px;
                margin-bottom: 10px;
                gap: 10px;
            }

            .credential-badge {
                padding: 5px 10px;
                font-size: 10px;
                border-radius: 7px;
            }

            .credential-text {
                font-size: 12px;
                gap: 10px;
            }

            .login-footer {
                font-size: 12px;
                margin-top: 24px;
                flex-direction: column;
                gap: 6px;
            }

            .login-footer i {
                font-size: 14px;
            }
        }

        @media (max-width: 400px) {
            body {
                padding: 10px;
            }

            .login-header {
                padding: 32px 20px 28px;
            }

            .login-header .logo {
                width: 70px;
                height: 70px;
            }

            .login-header .logo i {
                font-size: 32px;
            }

            .login-header h2 {
                font-size: 24px;
            }

            .login-header p {
                font-size: 13px;
            }

            .login-body {
                padding: 28px 20px 24px;
            }

            .form-control {
                height: 50px;
                font-size: 13px;
            }

            .btn-login {
                height: 52px;
                font-size: 14px;
            }

            .credential-text {
                font-size: 11px;
            }
        }

        @media (max-width: 576px) and (orientation: landscape) {
            body {
                padding: 10px;
            }

            .login-header {
                padding: 24px 20px;
            }

            .login-header .logo {
                width: 60px;
                height: 60px;
                margin-bottom: 12px;
            }

            .login-header h2 {
                font-size: 22px;
            }

            .login-body {
                padding: 24px 20px;
            }

            .demo-credentials {
                padding: 16px;
                margin-top: 20px;
            }

            .login-footer {
                margin-top: 20px;
                font-size: 11px;
            }
        }

        @media (min-width: 768px) and (max-width: 992px) {
            .login-container {
                max-width: 500px;
            }
        }


        .alert {
            padding: 16px 18px;
            border-radius: 12px;
            margin-bottom: 24px;
            font-size: 14px;
            font-weight: 500;
            display: flex;
            align-items: center;
            gap: 12px;
            animation: fadeInDown 0.5s ease;
        }

        @keyframes fadeInDown {
            from {
                opacity: 0;
                transform: translateY(-10px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .alert-danger {
            background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
            color: #991b1b;
            border: 2px solid #fecaca;
        }

        .alert-danger::before {
            content: '⚠️';
            font-size: 18px;
        }

        .alert-success {
            background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
            color: #166534;
            border: 2px solid #bbf7d0;
        }

        .alert-success::before {
            content: '✓';
            font-size: 18px;
        }
    </style>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
</head>
<body>
    <div class="login-container">
        <div class="login-card">
            <div class="login-header">
                <div class="logo">
                    <img src="<?= base_url('assets/images/auriga-logo.png') ?>" alt="Auriga" style="width: 55px; height: 55px; object-fit: contain;">
                </div>
                <h2>Auriga Portal</h2>
                <p>Sign in to your account</p>
            </div>
            
            <div class="login-body">
                <?php if($this->session->flashdata('error')): ?>
                <div class="alert alert-danger">
                    <?php echo $this->session->flashdata('error'); ?>
                </div>
                <?php endif; ?>
                
                <?php if($this->session->flashdata('success')): ?>
                <div class="alert alert-success">
                    <?php echo $this->session->flashdata('success'); ?>
                </div>
                <?php endif; ?>

                <form method="POST" action="<?php echo base_url('auth/login'); ?>">
                    <div class="form-group">
                        <label for="username">Username</label>
                        <div class="input-wrapper">
                            <input type="text" 
                                   class="form-control" 
                                   id="username" 
                                   name="username" 
                                   placeholder="Enter your username" 
                                   required 
                                   autofocus>
                            <i class="fas fa-user input-icon"></i>
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="password">Password</label>
                        <div class="input-wrapper">
                            <input type="password" 
                                   class="form-control" 
                                   id="password" 
                                   name="password" 
                                   placeholder="Enter your password" 
                                   required>
                            <i class="fas fa-lock input-icon"></i>
                            <i class="fas fa-eye toggle-password" id="togglePassword" title="Show password"></i>
                        </div>
                    </div>

                    <button type="submit" class="btn-login">
                        <i class="fas fa-sign-in-alt"></i>
                        Sign In
                    </button>
                </form>
            </div>
        </div>

        <div class="login-footer">
            <i class="fas fa-shield-alt"></i>
            <span>Secure Login • Auriga Portal © 2025</span>
        </div>
    </div>

    <script>
        document.getElementById('togglePassword').addEventListener('click', function() {
            const passwordInput = document.getElementById('password');
            const toggleIcon = this;
            
            if (passwordInput.type === 'password') {
                passwordInput.type = 'text';
                toggleIcon.classList.remove('fa-eye');
                toggleIcon.classList.add('fa-eye-slash');
                toggleIcon.title = 'Hide password';
            } else {
                passwordInput.type = 'password';
                toggleIcon.classList.remove('fa-eye-slash');
                toggleIcon.classList.add('fa-eye');
                toggleIcon.title = 'Show password';
            }
        });
    </script>
</body>
</html>
