<template>
  <div class="min-h-screen flex bg-gradient-to-br from-white to-purple-600">
    <!-- Right side - Login Form -->
    <div class="w-full flex flex-col justify-center items-center p-8 lg:p-12">
      <div class="max-w-md w-full bg-white/90 p-8 rounded-lg border border-purple-600 space-y-6">
        <div class="mb-8">
          <h2 class="text-3xl font-semibold text-purple-600 mb-2">Login</h2>
        </div>

        <form @submit.prevent="handleLogin" class="space-y-6">
          <div>
            <input
                type="text"
                v-model="username"
                placeholder="Username"
                class="w-full px-4 py-3 rounded-lg bg-white border border-purple-600 text-gray-700 placeholder-gray-400 focus:outline-none focus:border-purple-500"
            />
          </div>

          <div>
            <input
                type="password"
                v-model="password"
                placeholder="Password"
                class="w-full px-4 py-3 rounded-lg bg-white border border-purple-600 text-gray-700 placeholder-gray-400 focus:outline-none focus:border-purple-500"
            />
          </div>

          <div class="flex items-center">
            <input
                type="checkbox"
                id="remember"
                v-model="rememberMe"
                class="w-4 h-4 rounded border-gray-300 bg-white text-purple-600 focus:ring-purple-500"
            />
            <label for="remember" class="ml-2 text-gray-700 text-sm">Remember me</label>
          </div>

          <button
              type="submit"
              class="w-full py-3 rounded-lg bg-purple-600 hover:bg-purple-700 text-white font-medium transition-colors"
          >
            Login
          </button>

          <div class="text-center">
            <a href="#" class="text-purple-600 hover:text-purple-500 text-sm">Forgot password?</a>
          </div>

          <!-- Language Selector -->
          <div class="mt-8 flex items-center justify-center gap-2">
            <span class="text-gray-700 text-sm">Language:</span>
            <select
                v-model="language"
                class="px-3 py-1.5 rounded bg-white border border-gray-300 text-gray-700 focus:outline-none focus:border-purple-500"
            >
              <option value="en">English</option>
              <option value="es">Español</option>
              <option value="fr">Français</option>
            </select>
          </div>
        </form>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { useRoute } from 'vue-router'

const username = ref('')
const password = ref('')
const rememberMe = ref(false)
const language = ref('en')

const handleLogin = () => {
  if (username.value === 'admin' && password.value === 'admin') {
    // Redirect to portal
    const router = useRoute();
    router.push('/portal')
  } else {
    alert('Invalid username or password')
  }
}
</script>
