/**
 * Login Page - Glassmorphism + Animated Background
 * Modern, professional login with animated gradient background
 */

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overflow: hidden;
  background: #0f172a;
  color: #e2e8f0;
}

/* ============================================================
   ANIMATED BACKGROUND
   ============================================================ */
.bg-animated {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

/* Main gradient - animated color shift */
.bg-gradient {
  position: absolute;
  inset: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    -45deg,
    #0f172a 0%,
    #1e1b4b 20%,
    #172554 40%,
    #0c4a6e 55%,
    #134e4a 70%,
    #1e1b4b 85%,
    #0f172a 100%
  );
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  25%  { background-position: 100% 50%; }
  50%  { background-position: 100% 100%; }
  75%  { background-position: 0% 100%; }
  100% { background-position: 0% 50%; }
}

/* Floating shapes */
.bg-shapes {
  position: absolute;
  inset: 0;
}

.shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.3;
  animation: float 20s ease-in-out infinite;
}

.shape-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.5), transparent 70%);
  top: -15%;
  left: -10%;
  animation-duration: 18s;
  animation-delay: 0s;
}

.shape-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.4), transparent 70%);
  top: 50%;
  right: -10%;
  animation-duration: 22s;
  animation-delay: -5s;
}

.shape-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.35), transparent 70%);
  bottom: -10%;
  left: 20%;
  animation-duration: 25s;
  animation-delay: -8s;
}

.shape-4 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.3), transparent 70%);
  top: 20%;
  left: 60%;
  animation-duration: 20s;
  animation-delay: -3s;
}

.salamandra {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.25), transparent 70%);
  top: 60%;
  left: 10%;
  animation-duration: 28s;
  animation-delay: -12s;
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  25% {
    transform: translate(60px, -80px) scale(1.1);
  }
  50% {
    transform: translate(-40px, 60px) scale(0.95);
  }
  75% {
    transform: translate(80px, 40px) scale(1.05);
  }
}

/* Subtle grid overlay */
.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: gridMove 30s linear infinite;
}

@keyframes gridMove {
  0%   { transform: translate(0, 0); }
  100% { transform: translate(60px, 60px); }
}

/* ============================================================
   LOGIN WRAPPER - Centered layout
   ============================================================ */
.login-wrapper {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

/* ============================================================
   LOGIN CARD - Glassmorphism
   ============================================================ */
.login-card {
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.35),
    0 10px 25px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: cardEntry 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.2s;
}

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

/* ============================================================
   LOGO
   ============================================================ */
.login-logo {
  text-align: center;
  margin-bottom: 1.5rem;
  animation: logoEntry 0.6s ease both;
  animation-delay: 0.5s;
}

.login-logo img {
  max-height: 72px;
  width: auto;
  filter: brightness(1.1) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
  transition: transform 0.3s ease, filter 0.3s ease;
}

.login-logo img:hover {
  transform: scale(1.05);
  filter: brightness(1.2) drop-shadow(0 6px 20px rgba(0, 0, 0, 0.4));
}

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

/* ============================================================
   TITLE
   ============================================================ */
.login-title {
  text-align: center;
  margin-bottom: 2rem;
  animation: titleEntry 0.6s ease both;
  animation-delay: 0.6s;
}

.login-title h1 {
  font-size: 1.625rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.375rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff, #a5b4fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-title p {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

/* ============================================================
   ERROR ALERT
   ============================================================ */
.login-alert {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: #fca5a5;
  animation: shake 0.5s ease;
}

.login-alert i {
  font-size: 1.1rem;
  color: #f87171;
  flex-shrink: 0;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-6px); }
  30% { transform: translateX(5px); }
  45% { transform: translateX(-4px); }
  60% { transform: translateX(3px); }
  75% { transform: translateX(-2px); }
}

/* ============================================================
   FORM
   ============================================================ */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: formEntry 0.6s ease both;
  animation-delay: 0.7s;
}

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

/* Input groups */
.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 1rem;
  z-index: 2;
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.95rem;
  transition: color 0.3s ease;
  pointer-events: none;
}

.input-group input {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 2.875rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  font-weight: 400;
  color: #ffffff;
  outline: none;
  transition: all 0.3s ease;
}

.input-group input::placeholder {
  color: rgba(255, 255, 255, 0.3);
  font-weight: 400;
}

.input-group input:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12), 0 4px 16px rgba(0, 0, 0, 0.1);
}

.input-group input:focus + .input-icon,
.input-group:focus-within .input-icon {
  color: rgba(165, 180, 252, 0.8);
}

/* Toggle password button */
.toggle-password {
  position: absolute;
  right: 1rem;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 0.9rem;
  transition: color 0.3s ease;
  z-index: 2;
}

.toggle-password:hover {
  color: rgba(255, 255, 255, 0.6);
}

/* ============================================================
   LOGIN BUTTON
   ============================================================ */
.login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.9375rem 1.5rem;
  margin-top: 0.5rem;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #ffffff;
  border: none;
  border-radius: 14px;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.login-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4), 0 4px 12px rgba(99, 102, 241, 0.2);
  background: linear-gradient(135deg, #818cf8, #6366f1);
}

.login-btn:hover::before {
  transform: translateX(100%);
}

.login-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.login-btn i {
  transition: transform 0.3s ease;
}

.login-btn:hover i {
  transform: translateX(4px);
}

/* ============================================================
   FOOTER
   ============================================================ */
.login-footer {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  animation: footerEntry 0.6s ease both;
  animation-delay: 0.9s;
}

.login-footer a {
  color: rgba(255, 255, 255, 0.4);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 400;
  transition: color 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.login-footer a:hover {
  color: rgba(165, 180, 252, 0.8);
}

.login-footer a i {
  transition: transform 0.3s ease;
}

.login-footer a:hover i {
  transform: rotate(180deg);
}

@keyframes footerEntry {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ============================================================
   BOTTOM TEXT
   ============================================================ */
.login-bottom {
  margin-top: 2rem;
  text-align: center;
  animation: bottomEntry 0.6s ease both;
  animation-delay: 1s;
}

.login-bottom p {
  color: rgba(255, 255, 255, 0.25);
  font-size: 0.75rem;
  font-weight: 400;
}

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

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 480px) {
  .login-card {
    padding: 2rem 1.5rem;
    border-radius: 20px;
    margin: 0;
  }

  .login-title h1 {
    font-size: 1.375rem;
  }

  .login-wrapper {
    padding: 1rem;
  }

  .shape {
    filter: blur(60px);
    opacity: 0.2;
  }
}

@media (max-height: 700px) {
  .login-card {
    padding: 1.75rem;
  }

  .login-logo {
    margin-bottom: 1rem;
  }

  .login-logo img {
    max-height: 56px;
  }

  .login-title {
    margin-bottom: 1.25rem;
  }

  .login-bottom {
    margin-top: 1rem;
  }
}

/* ============================================================
   DARK MODE PREFERENCE (auto-handled, always dark)
   ============================================================ */

/* Particles shimmer effect on hover */
.login-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.35),
    0 10px 25px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
