/**
 * KSO Landing Pages Public Styles
 * Enhanced email signup form with loading states and feedback
 */

/* Email Signup Form Enhancements */
#kso-email-signup-form {
  position: relative;
}

#signup-submit-btn {
  position: relative;
  transition: all 0.3s ease;
}

#signup-submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

#signup-submit-btn .spinner {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

#signup-submit-btn .signup-icon,
#signup-submit-btn .button-text {
  transition: opacity 0.2s ease;
}

#signup-submit-btn.loading .signup-icon,
#signup-submit-btn.loading .button-text {
  opacity: 0;
}

#signup-submit-btn.loading .spinner {
  display: block !important;
}

/* Rotating spinner animation */
.rotating {
  animation: rotate 1s linear infinite;
}

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

/* Form Messages */
.form-message {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
  transition: all 0.3s ease;
}

.form-message.success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.form-message.error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.form-message.warning {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fed7aa;
}

/* Email input validation states */
.email-input.error {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1) !important;
}

.email-input.success {
  border-color: #16a34a !important;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1) !important;
}

/* Loading overlay for form */
.form-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  backdrop-filter: blur(2px);
  transition: all 0.3s ease;
}

/* Success checkmark animation */
.success-checkmark {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #16a34a;
  position: relative;
  margin-right: 0.5rem;
}

.success-checkmark::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 3px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Error icon */
.error-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #dc2626;
  color: white;
  text-align: center;
  line-height: 16px;
  font-size: 12px;
  font-weight: bold;
  margin-right: 0.5rem;
}

/* Form accessibility improvements */
.email-form [aria-invalid="true"] {
  border-color: #dc2626;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Responsive form adjustments */
@media (max-width: 768px) {
  .form-message {
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
  }
  
  #signup-submit-btn {
    min-width: 100px;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .form-message.success {
    background: #000;
    color: #0f0;
    border-color: #0f0;
  }
  
  .form-message.error {
    background: #000;
    color: #f00;
    border-color: #f00;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .rotating {
    animation: none;
  }
  
  #signup-submit-btn,
  .form-message,
  .email-input {
    transition: none;
  }
}

/* Success Modal Styles */
.signup-success-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  max-width: 400px;
  width: 90%;
  margin: 0 auto;
  overflow: hidden;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  background: linear-gradient(135deg, #8B1538 0%, #A91D42 100%);
  color: white;
  padding: 2rem;
  text-align: center;
  position: relative;
}

.success-icon {
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: bold;
  margin: 0 auto 1rem;
  backdrop-filter: blur(10px);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  font-family: "Playfair Display", Georgia, serif;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.modal-close:hover {
  opacity: 1;
}

.modal-body {
  padding: 2rem;
  text-align: center;
}

.modal-body p {
  margin: 0 0 2rem;
  color: #666;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  justify-content: center;
}

.modal-actions .btn {
  min-width: 120px;
}

/* Modal responsive design */
@media (max-width: 480px) {
  .modal-content {
    width: 95%;
  }
  
  .modal-header {
    padding: 1.5rem;
  }
  
  .modal-body {
    padding: 1.5rem;
  }
  
  .success-icon {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
  }
}