/* =========================================
   auth.css - Authentication Modal Styles
   ========================================= */

.auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-modal);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--transition-slow),
    visibility var(--transition-slow);
}

.auth-modal.show {
  opacity: 1;
  visibility: visible;
}

/* Animated Background */
.auth-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  z-index: 0;
}

.auth-bg::before,
.auth-bg::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  animation: float 20s infinite ease-in-out;
}

.auth-bg::before {
  width: 600px;
  height: 600px;
  background: var(--accent-gradient);
  opacity: 0.15;
  top: -200px;
  left: -200px;
  animation-delay: 0s;
}

.auth-bg::after {
  width: 500px;
  height: 500px;
  background: linear-gradient(135deg, var(--purple-accent), var(--blue-accent));
  opacity: 0.15;
  bottom: -200px;
  right: -200px;
  animation-delay: -10s;
}

/* Auth Container - Desktop */
.auth-container {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: 32px;
  padding: 48px;
  max-width: 480px;
  width: 90%;
  position: relative;
  z-index: 1;
  box-shadow:
    var(--shadow-xl),
    0 0 100px rgba(0, 220, 130, 0.1);
  animation: slideUp 0.6s var(--ease-out-expo);
  overflow: hidden;
}

/* Gradient Border Effect */
.auth-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  /* background: var(--accent-gradient);
  animation: shimmer 3s linear infinite; */
}

/* Logo Section */
.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 32px;
  animation: fadeInScale 0.8s var(--ease-out-expo) 0.2s both;
}

.auth-logo-icon {
  width: 72px;
  height: 72px;
  background: var(--accent-gradient);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 28px;
  color: white;
  box-shadow: var(--shadow-glow);
  position: relative;
  animation: pulse 3s ease-in-out infinite;
}

.auth-title {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
  text-align: center;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: fadeIn 0.8s var(--ease-out-expo) 0.3s both;
}

.auth-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 32px;
  animation: fadeIn 0.8s var(--ease-out-expo) 0.4s both;
}

/* Form Groups with Floating Labels */
.form-group {
  position: relative;
  margin-bottom: 24px;
  animation: fadeInUp 0.6s var(--ease-out-expo) calc(var(--i, 0) * 0.1s + 0.5s)
    both;
}

.auth-input {
  width: 100%;
  padding: 20px 16px 8px 16px;
  border: 2px solid var(--border-color);
  border-radius: 16px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 16px;
  transition: all var(--transition-base);
  outline: none;
}

.auth-input:focus {
  border-color: var(--accent-primary);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 4px rgba(0, 220, 130, 0.1);
}

.auth-input:not(:placeholder-shown) + .floating-label,
.auth-input:focus + .floating-label {
  top: 8px;
  font-size: 11px;
  color: var(--accent-primary);
}

.floating-label {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--text-tertiary);
  pointer-events: none;
  transition: all var(--transition-base);
  background: var(--bg-tertiary);
  padding: 0 4px;
}

/* Enhanced Buttons */
.auth-button {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 16px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  margin-bottom: 16px;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.6s var(--ease-out-expo) 0.8s both;
}

.auth-button.primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 20px rgba(0, 220, 130, 0.3);
}

.auth-button.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0, 220, 130, 0.4);
  background: var(--accent-gradient-hover);
}

.auth-button.primary:active {
  transform: translateY(0);
}

/* Loading State */
.auth-button.loading {
  color: transparent;
  pointer-events: none;
}

.auth-button.loading::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin-left: -10px;
  margin-top: -10px;
  border: 2px solid white;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spinner 0.6s linear infinite;
}

/* Divider */
.auth-divider {
  text-align: center;
  position: relative;
  margin: 24px 0;
  color: var(--text-tertiary);
  font-size: 13px;
  animation: fadeIn 0.6s var(--ease-out-expo) 0.9s both;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: calc(50% - 30px);
  height: 1px;
  background: var(--border-color);
}

.auth-divider::before {
  left: 0;
}

.auth-divider::after {
  right: 0;
}

/* Social Buttons */
.social-buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  animation: fadeInUp 0.6s var(--ease-out-expo) 1s both;
}

.social-button {
  flex: 1;
  padding: 14px;
  border: 2px solid var(--border-color);
  border-radius: 16px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.social-button:hover {
  background: var(--bg-elevated);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.social-button img {
  width: 20px;
  height: 20px;
}

/* Switch Link */
.auth-switch {
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  animation: fadeIn 0.6s var(--ease-out-expo) 1.1s both;
}

.auth-switch a {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* Error Message */
.auth-error {
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.2);
  color: var(--red-accent);
  font-size: 13px;
  margin-top: 16px;
  display: none;
  animation: shake 0.5s var(--ease-out-expo);
}

.auth-error:not(:empty) {
  display: block;
}

/* Success Message */
.auth-success {
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(0, 220, 130, 0.1);
  border: 1px solid rgba(0, 220, 130, 0.2);
  color: var(--accent-primary);
  font-size: 13px;
  margin-top: 16px;
  display: none;
}

.auth-success:not(:empty) {
  display: block;
}

/* =========================================
   Mobile Auth Styles
   ========================================= */
@media (max-width: 1023px) {
  .auth-container {
    border-radius: 32px 32px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 100%;
    width: 100%;
    padding: 32px 24px;
    padding-bottom: calc(32px + var(--safe-area-bottom));
    animation: slideUpMobile 0.5s var(--ease-out-expo);
    max-height: 90vh;
    overflow-y: auto;
  }

  @keyframes slideUpMobile {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }

  .auth-logo-icon {
    width: 64px;
    height: 64px;
    font-size: 24px;
    border-radius: 20px;
  }

  .auth-title {
    font-size: 24px;
  }

  .auth-subtitle {
    font-size: 14px;
    margin-bottom: 24px;
  }

  .form-group {
    margin-bottom: 20px;
  }

  .auth-input {
    padding: 18px 14px 6px 14px;
    font-size: 16px; /* Prevents zoom on iOS */
    border-radius: 14px;
  }

  .auth-button {
    padding: 14px;
    font-size: 14px;
    border-radius: 14px;
  }

  .social-button {
    padding: 12px;
    font-size: 13px;
    border-radius: 14px;
  }
}

/* =========================================
   Forgot Password Styles
   ========================================= */

.forgot-password-wrapper {
  text-align: right;
  margin-top: -12px;
  margin-bottom: 20px;
  animation: fadeIn 0.6s var(--ease-out-expo) 0.7s both;
}

.forgot-password-link {
  color: var(--text-tertiary);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: color var(--transition-base);
  font-weight: 500;
}

.forgot-password-link:hover {
  color: var(--accent-primary);
  text-decoration: underline;
}

/* Forgot Password Form */
#forgotPasswordForm {
  animation: fadeInUp 0.4s var(--ease-out-expo);
}

.forgot-password-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--accent-primary);
  animation: fadeInScale 0.5s var(--ease-out-expo);
}

.forgot-password-icon svg {
  background: rgba(0, 220, 130, 0.1);
  border-radius: 50%;
  padding: 12px;
  width: 64px;
  height: 64px;
}

.forgot-password-desc {
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.5;
}

/* Secondary (Back) Button */
.auth-button.secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 2px solid var(--border-color);
  margin-bottom: 0;
}

.auth-button.secondary:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--text-tertiary);
  transform: translateY(-1px);
}

/* Sent State */
.auth-button.sent {
  background: rgba(0, 220, 130, 0.15) !important;
  color: var(--accent-primary) !important;
  border: 2px solid rgba(0, 220, 130, 0.3);
  pointer-events: none;
}

/* =========================================
   Mobile Forgot Password
   ========================================= */
@media (max-width: 1023px) {
  .forgot-password-wrapper {
    margin-top: -8px;
    margin-bottom: 16px;
  }

  .forgot-password-link {
    font-size: 14px; /* Larger tap target on mobile */
    padding: 4px 0;
  }

  .forgot-password-desc {
    font-size: 13px;
  }

  .forgot-password-icon svg {
    width: 56px;
    height: 56px;
  }
}

/* Remove default link formatting */
.clean-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: opacity var(--transition-base, 0.2s ease);
}

/* Add a subtle hover effect */
.clean-link:hover {
  opacity: 0.8;
}

/* Ensure the strong tag inside the link also inherits color */
.clean-link strong {
  color: inherit;
}
