/* Devise Forms Animations and Enhancements */

/* Entrance Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Micro-interactions */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

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

/* Ripple Effect */
@keyframes ripple {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Success Checkmark */
@keyframes checkmark {
  0% {
    stroke-dashoffset: 100;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

/* Loading Spinner */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Floating Label */
.floating-label-group {
  position: relative;
  margin-bottom: 1.5rem;
}

.floating-label {
  position: absolute;
  top: 50%;
  left: 1rem;
  transform: translateY(-50%);
  transition: all 0.3s ease;
  pointer-events: none;
  color: var(--theme-muted-text, #6b7280);
  background: var(--theme-background, #ffffff);
  padding: 0 0.25rem;
}

.floating-label-group input:focus ~ .floating-label,
.floating-label-group input:not(:placeholder-shown) ~ .floating-label {
  top: 0;
  font-size: 0.75rem;
  color: var(--theme-primary, #4f46e5);
}

/* Input Icons */
.input-icon-group {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--theme-muted-text, #6b7280);
  transition: color 0.3s ease;
}

.input-icon-group input {
  padding-left: 2.75rem;
}

.input-icon-group input:focus ~ .input-icon {
  color: var(--theme-primary, #4f46e5);
}

/* Password Toggle */
.password-toggle {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: var(--theme-muted-text, #6b7280);
  transition: color 0.3s ease;
  background: none;
  border: none;
  padding: 0.25rem;
}

.password-toggle:hover {
  color: var(--theme-primary, #4f46e5);
}

/* Password Strength Meter */
.password-strength-meter {
  height: 4px;
  margin-top: 0.5rem;
  background: var(--theme-border, #e5e7eb);
  border-radius: 2px;
  overflow: hidden;
}

.password-strength-meter-fill {
  height: 100%;
  transition: width 0.3s ease, background-color 0.3s ease;
  border-radius: 2px;
}

.password-strength-weak {
  width: 33%;
  background-color: #ef4444;
}

.password-strength-medium {
  width: 66%;
  background-color: #f59e0b;
}

.password-strength-strong {
  width: 100%;
  background-color: #10b981;
}

/* Requirements Checklist */
.password-requirements {
  margin-top: 0.75rem;
  font-size: 0.875rem;
}

.password-requirement {
  display: flex;
  align-items: center;
  margin-bottom: 0.25rem;
  transition: all 0.3s ease;
}

.password-requirement-icon {
  width: 16px;
  height: 16px;
  margin-right: 0.5rem;
  transition: all 0.3s ease;
}

.password-requirement.met {
  color: #10b981;
}

.password-requirement.met .password-requirement-icon {
  color: #10b981;
}

/* Button Enhancements */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-ripple:active::after {
  width: 300px;
  height: 300px;
}

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

.btn-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid #ffffff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* Form Card */
.devise-form-card {
  animation: fadeInUp 0.5s ease;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Form Fields */
.devise-input {
  transition: all 0.3s ease;
  border-width: 2px;
}

.devise-input:focus {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.devise-input:hover:not(:focus) {
  border-color: var(--theme-accent, #6366f1);
}

/* Checkbox */
.devise-checkbox {
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--theme-border, #e5e7eb);
  border-radius: 4px;
  transition: all 0.3s ease;
  position: relative;
  cursor: pointer;
}

.devise-checkbox:checked {
  background-color: var(--theme-primary, #4f46e5);
  border-color: var(--theme-primary, #4f46e5);
}

.devise-checkbox:checked::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 14px;
  animation: scaleIn 0.2s ease;
}

/* Links */
.devise-link {
  position: relative;
  transition: all 0.3s ease;
  text-decoration: none;
}

.devise-link::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--theme-primary, #4f46e5);
  transition: width 0.3s ease;
}

.devise-link:hover::after {
  width: 100%;
}

/* Background Pattern Animation */
@keyframes backgroundMove {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 50px 50px;
  }
}

.auth-background-animated {
  animation: backgroundMove 20s linear infinite;
}

/* Error Animation */
.form-error {
  animation: shake 0.5s ease;
}

/* Success Animation */
@keyframes successBounce {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.form-success {
  animation: successBounce 0.5s ease;
}

/* Subtle Confetti (CSS only) */
@keyframes confetti-fall {
  to {
    transform: translateY(100vh) rotate(360deg);
  }
}

.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  background: var(--theme-primary, #4f46e5);
  animation: confetti-fall 3s linear;
  z-index: 9999;
}

/* Progress Bar */
.form-progress {
  height: 3px;
  background: var(--theme-border, #e5e7eb);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 2rem;
}

.form-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--theme-primary, #4f46e5), var(--theme-accent, #6366f1));
  transition: width 0.3s ease;
  border-radius: 3px;
}

/* Focus Trap for Accessibility */
.focus-trap:focus {
  outline: 2px solid var(--theme-primary, #4f46e5);
  outline-offset: 2px;
}

/* Skip Link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--theme-primary, #4f46e5);
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* Smooth Turbo Frame content replacement */
.turbo-progress-bar {
  background-color: var(--theme-primary, #4f46e5);
}