/* ========================================
   ULTRA-MODERN LOGIN PAGE
   Stunning login with glassmorphism & animations
   ======================================== */

/* ==================== MODERN LOGIN TOKENS ==================== */
:root {
  /* Color System */
  --login-primary: #6366F1;
  --login-primary-dark: #4F46E5;
  --login-accent: #F59E0B;
  --login-success: #10B981;
  --login-danger: #EF4444;
  
  /* Text Colors */
  --login-text: #0F172A;
  --login-text-secondary: #475569;
  --login-text-muted: #94A3B8;
  
  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
  
  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-8: 3rem;
  
  /* Typography */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  
  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
  --gradient-warm: linear-gradient(135deg, #FA8BFF 0%, #2BD2FF 100%);
  --gradient-sunset: linear-gradient(135deg, #FF6B6B 0%, #FFD93D 100%);
}

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

/* ==================== BODY ==================== */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
  position: relative;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==================== ANIMATED BACKGROUND ==================== */
body::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(255, 139, 255, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(43, 210, 255, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 40% 20%, rgba(255, 107, 107, 0.1) 0%, transparent 50%);
  animation: bgMove 20s ease-in-out infinite;
}

@keyframes bgMove {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-5%, 5%) scale(1.1); }
}

/* Floating Particles */
.fireworks-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.fireworks-bg::before,
.fireworks-bg::after {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.3;
  animation: float 15s ease-in-out infinite;
}

.fireworks-bg::before {
  background: linear-gradient(135deg, #FA8BFF, #2BD2FF);
  top: -150px;
  left: -150px;
}

.fireworks-bg::after {
  background: linear-gradient(135deg, #FFD93D, #FF6B6B);
  bottom: -150px;
  right: -150px;
  animation-delay: 7.5s;
}

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

/* ==================== LOGIN CONTAINER ==================== */
.login-container {
  max-width: 480px;
  width: 100%;
  position: relative;
  z-index: 1;
  animation: slideUp 0.6s ease-out;
}

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

/* ==================== LOGIN HEADER ==================== */
.login-header {
  text-align: center;
  margin-bottom: var(--space-8);
  color: white;
}

.logo {
  width: 88px;
  height: 88px;
  margin: 0 auto var(--space-5);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 2px solid var(--glass-border);
  border-radius: var(--radius-2xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-4xl);
  box-shadow: var(--glass-shadow);
  animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(5deg); }
}

.login-header h1 {
  font-size: var(--text-3xl);
  font-weight: 800;
  margin-bottom: var(--space-3);
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  letter-spacing: -0.02em;
}

.login-header p {
  font-size: var(--text-lg);
  font-weight: 500;
  opacity: 0.95;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ==================== LOGIN BOX ==================== */
.login-box {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 2px solid var(--glass-border);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-2xl);
}

/* ==================== FORM ==================== */
.input-group {
  margin-bottom: var(--space-6);
}

.input-group label {
  display: block;
  margin-bottom: var(--space-3);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--login-text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-group label i {
  margin-right: var(--space-2);
  color: var(--login-primary);
}

.input-group input {
  width: 100%;
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-base);
  font-family: inherit;
  color: var(--login-text);
  background: white;
  border: 2px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-xl);
  transition: all var(--transition-base);
}

.input-group input:focus {
  outline: none;
  border-color: var(--login-primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
  transform: translateY(-2px);
}

.input-group input::placeholder {
  color: var(--login-text-muted);
}

/* Password Wrapper */
.password-wrapper {
  position: relative;
}

.password-wrapper input {
  padding-right: 50px;
}

.toggle-password {
  position: absolute;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--login-text-muted);
  font-size: var(--text-lg);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
}

.toggle-password:hover {
  background: rgba(99, 102, 241, 0.1);
  color: var(--login-primary);
}

/* ==================== ERROR MESSAGE ==================== */
.error-message {
  display: none;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
  background: rgba(239, 68, 68, 0.1);
  border: 2px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-xl);
  color: var(--login-danger);
  font-size: var(--text-sm);
  font-weight: 600;
  animation: shake 0.5s ease;
}

.error-message.show {
  display: flex;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.error-message i {
  font-size: var(--text-xl);
}

/* ==================== LOGIN BUTTON ==================== */
.btn-login {
  width: 100%;
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-base);
  font-weight: 700;
  color: white;
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--radius-xl);
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
}

.btn-login:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: var(--shadow-2xl);
}

.btn-login:active:not(:disabled) {
  transform: translateY(-1px);
}

.btn-login:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-login i {
  font-size: var(--text-lg);
}

/* ==================== BACK TO HOME ==================== */
.back-to-home {
  text-align: center;
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 2px solid rgba(99, 102, 241, 0.1);
}

.back-to-home a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--login-text-secondary);
  background: rgba(99, 102, 241, 0.05);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: all var(--transition-base);
}

.back-to-home a:hover {
  color: var(--login-primary);
  background: rgba(99, 102, 241, 0.1);
  transform: translateX(-4px);
}

.back-to-home i {
  font-size: var(--text-base);
}

/* ==================== FOOTER ==================== */
.login-footer {
  text-align: center;
  margin-top: var(--space-6);
  color: white;
  font-size: var(--text-sm);
  font-weight: 500;
  opacity: 0.9;
}

.login-footer i {
  color: #FFD93D;
  animation: heartbeat 1.5s ease infinite;
  display: inline-block;
  margin: 0 var(--space-1);
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  25%, 75% { transform: scale(1.1); }
  50% { transform: scale(1.3); }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  body {
    padding: var(--space-4);
  }
  
  .login-container {
    max-width: 100%;
  }
  
  .login-box {
    padding: var(--space-6);
  }
  
  .login-header h1 {
    font-size: var(--text-2xl);
  }
  
  .logo {
    width: 72px;
    height: 72px;
    font-size: var(--text-3xl);
  }
}

@media (max-width: 480px) {
  .login-box {
    padding: var(--space-5);
  }
  
  .input-group {
    margin-bottom: var(--space-5);
  }
  
  .input-group input {
    padding: var(--space-3) var(--space-4);
  }
  
  .btn-login {
    padding: var(--space-3) var(--space-5);
  }
}

/* ==================== LOADING STATE ==================== */
.btn-login .fa-spinner {
  animation: spin 1s linear infinite;
}

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

/* ==================== FOCUS VISIBLE ==================== */
*:focus-visible {
  outline: 3px solid rgba(99, 102, 241, 0.5);
  outline-offset: 2px;
}

/* ==================== SELECTION ==================== */
::selection {
  background: rgba(99, 102, 241, 0.2);
  color: var(--login-text);
}

/* ==================== ACCESSIBILITY ==================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==================== CUSTOM SCROLLBAR ==================== */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* ==================== ADDITIONAL ANIMATIONS ==================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.fade-in {
  animation: fadeIn 0.4s ease-out;
}

.slide-in-right {
  animation: slideInRight 0.4s ease-out;
}

/* Input Focus Ring Enhancement */
.input-group input:focus {
  position: relative;
}

.input-group input:focus::after {
  content: '';
  position: absolute;
  inset: -4px;
  border: 2px solid var(--login-primary);
  border-radius: inherit;
  opacity: 0.3;
  pointer-events: none;
}
