/* ==========================================================================
   GLASS LOGIN PAGE
   Apple Liquid Glass Edition
   ========================================================================== */

/* ===== Page Layout ===== */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  margin: 0;
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    'SF Pro Display',
    'SF Pro Text',
    'Segoe UI',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  /* Animated mesh gradient background */
  background:
    radial-gradient(ellipse 100% 80% at 20% 10%, rgba(20, 136, 186, 0.2) 0%, transparent 50%),
    radial-gradient(ellipse 80% 60% at 80% 90%, rgba(0, 95, 150, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 60% 30%, rgba(20, 136, 186, 0.1) 0%, transparent 40%),
    linear-gradient(160deg, #e8f4fc 0%, #f0f7fb 30%, #e4f0f8 70%, #dbeaf5 100%);
  background-attachment: fixed;
  animation: backgroundShift 20s ease-in-out infinite;
}

@keyframes backgroundShift {
  0%, 100% { background-position: 0% 0%; }
  50% { background-position: 100% 100%; }
}

/* Noise texture overlay */
.login-body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.02;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  z-index: 0;
}

.login-wrapper {
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
  animation: loginCardReveal 0.8s cubic-bezier(0.19, 1, 0.22, 1);
}

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

/* ===== Glass Login Card ===== */
.login-card {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(30px) saturate(200%);
  -webkit-backdrop-filter: blur(30px) saturate(200%);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow:
    0 24px 80px rgba(0, 95, 150, 0.2),
    0 8px 32px rgba(0, 0, 0, 0.08),
    inset 0 1px 1px rgba(255, 255, 255, 0.8);
  overflow: hidden;
  position: relative;
}

/* Glass highlight on card top */
.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 5%, rgba(255, 255, 255, 0.9) 50%, transparent 95%);
  pointer-events: none;
  z-index: 1;
}

/* ===== Header Section ===== */
.login-header {
  background: linear-gradient(135deg, #005f96 0%, #004a75 50%, #003d63 100%);
  color: #ffffff;
  padding: 2.5rem 2rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Animated shimmer effect on header */
.login-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  animation: headerShimmer 3s ease-in-out infinite;
}

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

/* Glass inner highlight on header */
.login-header::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  pointer-events: none;
}

.login-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  line-height: 1;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  animation: iconFloat 3s ease-in-out infinite;
}

@keyframes iconFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.login-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  color: #ffffff;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.login-subtitle {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
  font-weight: 400;
}

/* ===== Form Section ===== */
.login-form {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #585858;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ===== Glass Input Fields ===== */
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.login-input {
  width: 100%;
  padding: 0.875rem 3rem 0.875rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 12px;
  font-size: 1rem;
  color: #000000;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: inherit;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.login-input::placeholder {
  color: #888;
  opacity: 0.7;
}

.login-input:hover {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(20, 136, 186, 0.3);
}

.login-input:focus {
  outline: none;
  border-color: #1488ba;
  background: rgba(255, 255, 255, 0.9);
  box-shadow:
    0 0 0 4px rgba(20, 136, 186, 0.15),
    inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Input icon */
.input-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: #1488ba;
  pointer-events: none;
  width: 20px;
  height: 20px;
  transition: all 0.3s ease;
}

.login-input:focus ~ .input-icon {
  color: #005f96;
  transform: translateY(-50%) scale(1.1);
}

/* ===== Glass Login Button ===== */
.btn-login {
  width: 100%;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, #005f96 0%, #1488ba 100%);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: inherit;
  margin-top: 0.5rem;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 4px 16px rgba(0, 95, 150, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Glass highlight on button */
.btn-login::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, transparent 100%);
  pointer-events: none;
  border-radius: 12px 12px 0 0;
}

/* Shimmer effect */
.btn-login::after {
  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 ease;
}

.btn-login:hover {
  background: linear-gradient(135deg, #1488ba 0%, #0891b2 100%);
  transform: translateY(-2px) scale(1.01);
  box-shadow:
    0 8px 24px rgba(0, 95, 150, 0.35),
    0 0 20px rgba(20, 136, 186, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

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

.btn-login:active {
  transform: translateY(0) scale(0.99);
  box-shadow:
    0 2px 8px rgba(0, 95, 150, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-login:disabled {
  background: linear-gradient(135deg, #94a3b8 0%, #9ca3af 100%);
  cursor: not-allowed;
  opacity: 0.7;
  transform: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ===== Error Message ===== */
.error-message {
  padding: 0.875rem 1rem;
  background: rgba(254, 226, 226, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(252, 165, 165, 0.5);
  border-radius: 12px;
  color: #dc2626;
  font-size: 0.875rem;
  margin: 0 2rem;
  text-align: center;
  animation: errorShake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ===== Footer Section ===== */
.login-footer {
  padding: 1.5rem 2rem;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.3);
}

.footer-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: #005f96;
  margin: 0 0 0.25rem 0;
}

.footer-subtitle {
  font-size: 0.8rem;
  color: #585858;
  margin: 0;
}

/* ===== OAuth Section ===== */
.oauth-section {
  padding: 2rem;
}

.btn-microsoft {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.875rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #585858;
  border: 1px solid rgba(255, 255, 255, 0.4);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: inherit;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.06),
    inset 0 1px 1px rgba(255, 255, 255, 0.6);
}

.btn-microsoft:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: #0078d4;
  color: #0078d4;
  transform: translateY(-2px) scale(1.01);
  box-shadow:
    0 8px 24px rgba(0, 120, 212, 0.15),
    inset 0 1px 1px rgba(255, 255, 255, 0.6);
}

.btn-microsoft:active {
  transform: translateY(0) scale(0.99);
}

/* Hide OTP section when in OAuth mode */
.login-card.oauth-only .otp-section {
  display: none !important;
}

.login-card.oauth-only .oauth-section {
  display: block !important;
}

/* ===== Loading State ===== */
.btn-login.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn-login.loading::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  top: 50%;
  left: 50%;
  margin-left: -11px;
  margin-top: -11px;
  border: 3px solid transparent;
  border-radius: 50%;
  border-top-color: #ffffff;
  border-right-color: rgba(255, 255, 255, 0.5);
  animation: loginSpin 0.7s linear infinite;
}

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

/* ===== Responsive Design ===== */
@media (max-width: 640px) {
  .login-body {
    padding: 1rem;
  }

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

  .login-header {
    padding: 2rem 1.5rem;
  }

  .login-icon {
    font-size: 2.75rem;
  }

  .login-title {
    font-size: 1.25rem;
  }

  .login-form {
    padding: 1.5rem;
  }

  .login-footer {
    padding: 1.25rem 1.5rem;
  }

  .error-message {
    margin: 0 1.5rem;
  }

  .oauth-section {
    padding: 1.5rem;
  }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  .login-body {
    animation: none;
  }

  .login-wrapper {
    animation: none;
  }

  .login-header::before {
    animation: none;
  }

  .login-icon {
    animation: none;
  }

  .btn-login::after {
    transition: none;
  }

  .error-message {
    animation: none;
  }
}
