<template>
  <div class="login-container">
    <!-- Static gradient background with CSS animations instead of using directives -->
    <div class="background-animation"></div>

    <!-- Simple layout without nested component issues -->
    <div class="login-wrapper">
      <div class="login-card">
        <div class="card-header">
          <h2 class="title">SIMRS</h2>
          <p class="subtitle">Sistem Informasi Manajemen Rumah Sakit</p>
        </div>

        <div class="card-content">
          <button v-for="provider in providers" :key="provider.id" class="login-button" @click="signIn(provider.id)">
            Sign in with {{ provider.name }}
          </button>

          <div class="footer">
            <p>© {{ new Date().getFullYear() }} SIMRS. All rights reserved.</p>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
definePageMeta({
  layout: 'auth',
  auth: {
    unauthenticatedOnly: false,
    navigateAuthenticatedTo: '/coba2',
  },
})

const { signIn, getProviders } = useAuth()
const providers = await getProviders()
console.log(providers)
</script>

<style scoped>
.login-container {
  position: relative;
  min-height: 100vh;
  width: 100%;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #0072ff 0%, #00c6ff 100%);
}

/* Background animation using CSS only - no SVG or complex animations */
.background-animation {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg,
      rgba(0, 114, 255, 0.8) 0%,
      rgba(0, 198, 255, 0.8) 100%);
  opacity: 0.7;
}

.background-animation::before,
.background-animation::after {
  content: '';
  position: absolute;
  left: -50%;
  top: -50%;
  width: 200%;
  height: 200%;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 40%;
  z-index: 1;
  animation: rotate 25s linear infinite;
}

.background-animation::after {
  border-radius: 35%;
  background-color: rgba(255, 255, 255, 0.15);
  animation: rotate 30s linear infinite;
}

@keyframes rotate {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.login-wrapper {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 440px;
  padding: 20px;
}

.login-card {
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.login-card:hover {
  transform: translateY(-5px);
}

.card-header {
  padding: 20px;
  text-align: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.title {
  margin: 0;
  color: #0072ff;
  font-size: 24px;
  font-weight: bold;
}

.subtitle {
  margin: 5px 0 0;
  color: #555;
  font-size: 14px;
}

.card-content {
  padding: 20px;
}

.login-button {
  display: block;
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 16px;
  background-color: #0072ff;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.login-button:hover {
  background-color: #005fd6;
}

.footer {
  margin-top: 20px;
  text-align: center;
  color: #666;
  font-size: 12px;
}
</style>
