/* form-styles.css - Styles for AJAX form handling and popups */

/* Form loading state */
.ajax-form.loading {
  opacity: 0.7;
  pointer-events: none;
}

.ajax-form.loading button[type="submit"] {
  position: relative;
}

.ajax-form.loading button[type="submit"]:after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  margin: auto;
  border: 2px solid transparent;
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Form popup styles */
#form-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.form-popup-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
}

.form-popup-content {
  background: white;
  border-radius: 15px;
  max-width: 500px;
  width: 90%;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: popupFadeIn 0.3s ease-out;
  overflow: hidden;
}

.form-popup-header {
  padding: 20px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
}

.form-popup-header h3 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-color, #2c3e50);
}

.form-popup-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #666;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.form-popup-close:hover {
  background: #f0f0f0;
  color: #333;
}

.form-popup-body {
  padding: 30px;
  text-align: center;
}

.form-popup-body p {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text-color, #2c3e50);
}

/* Success styling */
#form-popup.success .form-popup-header {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  color: white;
}

#form-popup.success .form-popup-close {
  color: white;
}

#form-popup.success .form-popup-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Error styling */
#form-popup.error .form-popup-header {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
}

#form-popup.error .form-popup-close {
  color: white;
}

#form-popup.error .form-popup-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Info styling */
#form-popup.info .form-popup-header {
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
}

#form-popup.info .form-popup-close {
  color: white;
}

#form-popup.info .form-popup-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Animations */
@keyframes popupFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Form validation styles */
.ajax-form .form-group {
  position: relative;
}

.ajax-form .error-message {
  color: #e74c3c;
  font-size: 0.875rem;
  margin-top: 5px;
  display: none;
}

.ajax-form .form-control.is-invalid {
  border-color: #e74c3c;
  box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2);
}

.ajax-form .form-control.is-valid {
  border-color: #27ae60;
  box-shadow: 0 0 0 2px rgba(39, 174, 96, 0.2);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .form-popup-content {
    margin: 20px;
    width: calc(100% - 40px);
  }

  .form-popup-header {
    padding: 15px 20px;
  }

  .form-popup-body {
    padding: 20px;
  }

  .form-popup-header h3 {
    font-size: 1.3rem;
  }

  .form-popup-body p {
    font-size: 1rem;
  }
}

/* Focus management */
.form-popup-close:focus {
  outline: 2px solid #3498db;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .form-popup-content {
    border: 2px solid;
  }

  .form-popup-overlay {
    background: rgba(0, 0, 0, 0.9);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .form-popup-content,
  .ajax-form.loading button[type="submit"]:after {
    animation: none;
  }
}