:root {
  --bg-color: #0b0f19;
  --card-bg: rgba(18, 24, 38, 0.75);
  --card-border: rgba(255, 255, 255, 0.08);
  --input-bg: rgba(13, 17, 28, 0.65);
  --input-border: rgba(255, 255, 255, 0.12);
  --input-border-focus: #6366f1;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary-accent: #6366f1;
  --primary-hover: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.35);
  --accent-cyan: #06b6d4;
  --error-color: #f43f5e;
  --success-color: #10b981;
  --transition-speed: 0.25s;
}

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

body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow-x: hidden;
  padding: 1.5rem;
}

/* Dynamic background glowing ambient lights */
.background-decorations {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.45;
  animation: floatBlobs 12s infinite alternate ease-in-out;
}

.blob-1 {
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, #6366f1 0%, transparent 70%);
  top: -100px;
  left: -80px;
}

.blob-2 {
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, #06b6d4 0%, transparent 70%);
  bottom: -120px;
  right: -100px;
  animation-delay: -5s;
}

.blob-3 {
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, #ec4899 0%, transparent 70%);
  top: 40%;
  left: 60%;
  opacity: 0.25;
  animation-delay: -8s;
}

@keyframes floatBlobs {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(40px, 30px) scale(1.08);
  }
  100% {
    transform: translate(-30px, 50px) scale(0.95);
  }
}

/* Page Layout */
.page-container {
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
}

/* Auth Card */
.auth-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 2.75rem 2.25rem;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.5),
              0 0 50px -10px rgba(99, 102, 241, 0.15);
  animation: cardFadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cardFadeUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Header */
.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  color: #fff;
  margin-bottom: 1.25rem;
  box-shadow: 0 8px 24px var(--accent-glow);
  transition: transform 0.3s ease;
}

.logo-badge:hover {
  transform: rotate(6deg) scale(1.05);
}

.brand-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(to right, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

.brand-subtitle {
  font-size: 0.925rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* Form */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #e2e8f0;
}

.subtle-link {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-speed);
}

.subtle-link:hover {
  color: #a5b4fc;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 1rem;
  color: #64748b;
  pointer-events: none;
  transition: color var(--transition-speed);
}

.form-input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.75rem;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 12px;
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-speed), 
              box-shadow var(--transition-speed), 
              background-color var(--transition-speed);
}

.form-input::placeholder {
  color: #475569;
}

.form-input:focus {
  border-color: var(--input-border-focus);
  background-color: rgba(18, 24, 38, 0.9);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.18);
}

.form-input:focus + .input-icon,
.input-wrapper:focus-within .input-icon {
  color: var(--primary-accent);
}

/* Password Toggle */
.toggle-password {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-speed);
}

.toggle-password:hover {
  color: var(--text-main);
}

/* Validation error message */
.error-msg {
  display: none;
  font-size: 0.8rem;
  color: var(--error-color);
  margin-top: 0.2rem;
}

.form-group.has-error .error-msg {
  display: block;
}

.form-group.has-error .form-input {
  border-color: var(--error-color);
}

/* Remember me */
.remember-row {
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input {
  display: none;
}

.custom-checkbox {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-speed);
}

.checkbox-label input:checked + .custom-checkbox {
  background: var(--primary-accent);
  border-color: var(--primary-accent);
}

.checkbox-label input:checked + .custom-checkbox::after {
  content: '';
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

/* Action button */
.btn-primary {
  width: 100%;
  padding: 0.9rem;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  border: none;
  border-radius: 12px;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 10px 20px -5px var(--accent-glow);
  transition: all var(--transition-speed) cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 26px -5px rgba(99, 102, 241, 0.5);
  background: linear-gradient(135deg, #6d70f8, #5952f1);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary.loading .btn-text {
  visibility: hidden;
}

.btn-spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  position: absolute;
}

.btn-primary.loading .btn-spinner {
  display: block;
}

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

/* Status message */
.login-feedback {
  display: none;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.875rem;
  text-align: center;
}

.login-feedback.success {
  display: block;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.login-feedback.error {
  display: block;
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #fb7185;
}

/* Footer */
.auth-footer {
  margin-top: 1.75rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.highlight-link {
  color: #818cf8;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--transition-speed);
}

.highlight-link:hover {
  color: #c7d2fe;
  text-decoration: underline;
}

@media (max-width: 480px) {
  .auth-card {
    padding: 2rem 1.5rem;
    border-radius: 20px;
  }
  
  .brand-title {
    font-size: 1.5rem;
  }
}
