:root {
  --primary-gradient: linear-gradient(135deg, #1e3a8a 0%, #1e40af 25%, #3b82f6 50%, #1e40af 75%, #1e3a8a 100%);
  --success-gradient: linear-gradient(135deg, #059669 0%, #10b981 50%, #34d399 100%);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow-x: hidden;
}

.login-container {
  min-height: 100vh;
  background: var(--primary-gradient);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow: hidden;
}

.login-container::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(circle at 20% 80%, rgba(59,130,246,.15) 0%, transparent 60%),
    radial-gradient(circle at 80% 20%, rgba(16,185,129,.12) 0%, transparent 60%),
    radial-gradient(circle at 40% 40%, rgba(148,163,184,.08) 0%, transparent 60%);
  animation: float 25s ease-in-out infinite;
  z-index: 0;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0); }
  33% { transform: translateY(-30px) rotate(1deg); }
  66% { transform: translateY(30px) rotate(-1deg); }
}

.login-card {
  background: rgba(15,23,42,.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(148,163,184,.3);
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,.4), 0 0 0 1px rgba(59,130,246,.1) inset;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  min-width: 320px;
  position: relative;
  z-index: 10;
  transition: all .4s cubic-bezier(.175,.885,.32,1.275);
  margin: 0 auto;
}

.login-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0,0,0,.6);
  border-color: rgba(59,130,246,.5);
}

.logo-section {
  text-align: center;
  margin-bottom: 2.5rem;
}

.logo-container {
  position: relative;
  display: inline-block;
  margin-bottom: 1.5rem;
}

.login-logo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.3);
  object-fit: cover;
  transition: all .4s cubic-bezier(.175,.885,.32,1.275);
  position: relative;
  z-index: 2;
}

.logo-fallback {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: #fff;
  transition: all .4s cubic-bezier(.175,.885,.32,1.275);
}

.logo-glow {
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  border-radius: 50%;
  background: var(--success-gradient);
  opacity: 0;
  animation: pulse 2s infinite;
  z-index: 1;
}

@keyframes pulse {
  0% { opacity: 0; transform: scale(.8); }
  50% { opacity: .3; transform: scale(1.1); }
  100% { opacity: 0; transform: scale(.8); }
}

.brand-title {
  color: #fff;
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: .5rem;
  text-shadow: 0 2px 10px rgba(0,0,0,.3);
}

.brand-subtitle {
  color: rgba(255,255,255,.8);
  font-size: 1rem;
  font-weight: 400;
}

.btn-sso {
  background: var(--success-gradient);
  border: none;
  border-radius: 16px;
  padding: 1rem 2rem;
  font-weight: 600;
  font-size: 1.1rem;
  color: #fff;
  width: 100%;
  transition: all .3s cubic-bezier(.175,.885,.32,1.275);
  position: relative;
  overflow: hidden;
  margin-bottom: 2rem;
  box-shadow: 0 4px 15px rgba(5,150,105,.3);
  cursor: pointer;
}

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

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

.btn-sso:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(5,150,105,.5);
}

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

.btn-sso:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.messages-container {
  margin-bottom: 1.5rem;
}

.alert {
  background: rgba(15,23,42,.8);
  border: 1px solid rgba(148,163,184,.3);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: .75rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  backdrop-filter: blur(10px);
  animation: slideIn .3s ease-out;
}

.alert-error {
  border-color: rgba(239,68,68,.5);
  background: rgba(239,68,68,.1);
  color: #fca5a5;
}

.alert-success {
  border-color: rgba(34,197,94,.5);
  background: rgba(34,197,94,.1);
  color: #86efac;
}

.alert-info {
  border-color: rgba(59,130,246,.5);
  background: rgba(59,130,246,.1);
  color: #93c5fd;
}

.alert-warning {
  border-color: rgba(245,158,11,.5);
  background: rgba(245,158,11,.1);
  color: #fcd34d;
}

.btn-close {
  background: none;
  border: none;
  color: rgba(255,255,255,.7);
  font-size: 1.2rem;
  cursor: pointer;
  margin-left: auto;
  transition: color .3s;
}

.btn-close:hover {
  color: #fff;
}

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

.loading {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(5px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid rgba(255,255,255,.3);
  border-top: 3px solid #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-text {
  color: #fff;
  margin-top: 1rem;
  font-weight: 500;
}

@media (max-width: 768px) {
  .login-card {
    padding: 2rem;
    max-width: 100%;
    min-width: 280px;
  }
  .brand-title {
    font-size: 1.5rem;
  }
  .brand-subtitle {
    font-size: .9rem;
  }
  .btn-sso {
    padding: .875rem 1.5rem;
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .login-card {
    padding: 1.5rem;
    border-radius: 20px;
  }
  .brand-title {
    font-size: 1.25rem;
  }
  .brand-subtitle {
    font-size: .8rem;
  }
  .login-logo, .logo-fallback {
    width: 80px;
    height: 80px;
  }
}

.logo-fallback.hidden {
  display: none;
}

.btn-sso.disabled {
  opacity: .5;
  cursor: not-allowed;
}
