/* Form Handler Styles */

/* Field Error Styles */
.field-error {
  color: #dc2626;
  font-size: 0.875rem;
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.field-error::before {
  content: "⚠️";
  font-size: 0.75rem;
}

.form-input.error {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.form-input.error:focus {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2);
}

/* Loading Animation */
.btn-icon.loading {
  animation: spin 1s linear infinite;
}

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

/* Success Notification */
.form-success {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn 0.3s ease;
}

.success-content {
  background: var(--white);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  text-align: center;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-2xl);
  animation: slideUp 0.3s ease;
}

.success-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
}

.success-content h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: var(--space-3);
}

.success-content p {
  color: var(--gray-600);
  margin-bottom: var(--space-3);
  line-height: 1.6;
}

.success-content a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.success-content a:hover {
  text-decoration: underline;
}

/* Error Notification */
.form-error {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn 0.3s ease;
}

.error-content {
  background: var(--white);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  text-align: center;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-2xl);
  animation: slideUp 0.3s ease;
  border: 2px solid #dc2626;
}

.error-icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
}

.error-content h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #dc2626;
  margin-bottom: var(--space-3);
}

.error-content p {
  color: var(--gray-600);
  margin-bottom: var(--space-3);
  line-height: 1.6;
}

.error-content a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.error-content a:hover {
  text-decoration: underline;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

/* Form Improvements */
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
  outline: none;
}

.form-input:valid {
  border-color: #10b981;
}

.form-input:invalid:not(:placeholder-shown) {
  border-color: #dc2626;
}

/* Phone Input Formatting */
#phone {
  font-family: 'Courier New', monospace;
  letter-spacing: 0.05em;
}

/* Responsive */
@media (max-width: 768px) {
  .form-success,
  .form-error {
    padding: var(--space-2);
  }
  
  .success-content,
  .error-content {
    padding: var(--space-6);
  }
  
  .success-icon,
  .error-icon {
    font-size: 2.5rem;
  }
  
  .success-content h3,
  .error-content h3 {
    font-size: 1.25rem;
  }
}

@media (max-width: 480px) {
  .success-content,
  .error-content {
    padding: var(--space-4);
  }
  
  .success-icon,
  .error-icon {
    font-size: 2rem;
  }
}

/* Accessibility */
.form-input:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.field-error:focus {
  outline: 2px solid #dc2626;
  outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .form-input.error {
    border-width: 2px;
  }
  
  .field-error {
    font-weight: 600;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .btn-icon.loading {
    animation: none;
  }
  
  .form-success,
  .form-error {
    animation: none;
  }
  
  .success-content,
  .error-content {
    animation: none;
  }
}
