/**
 * Dynamic Form Styles
 * Styling for the dynamic form handler, preloader, and responsive layout
 */

/* Body scroll lock when modal is open */
body {
  overflow: auto;
  transition: overflow 0.3s ease;
}

body.modal-open {
  overflow: hidden;
}

/* Form Container Responsive Layout */
.circle-form_fields {
  display: grid;
  gap: 20px;
  margin-bottom: 30px;
}

/* Two fields per row on desktop */
@media (min-width: 768px) {
  .form-field-wrappper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }

  .form-field-wrappper .field-wrapper {
    width: 100%;
  }
}

/* One field per row on mobile */
@media (max-width: 767px) {
  .form-field-wrappper {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .form-field-wrappper .field-wrapper {
    width: 100%;
  }
}

/* Full width for checkbox groups and single fields */
.field-wrapper[style*="gridColumn"] {
  grid-column: 1 / -1 !important;
}

/* Checkbox field styling - One per row */
.circle-form_option-wrap {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 12px;
}

/* Checkbox wrapper - flex layout for alignment */
.w-checkbox {
  display: flex !important;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  margin: 0 !important;
}

.w-checkbox input {
  margin: 0 !important;
  cursor: pointer;
}

/* Checkbox input visual */
.w-checkbox-input {
  flex-shrink: 0;
}

/* Checkbox styling */
.circle-checkbox {
  width: 20px;
  height: 20px;
  border: 2px solid #ccc;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  background-color: #fff;
  flex-shrink: 0;
  cursor: pointer;
}

/* Checkbox label styling */
.circle-checkbox-label {
  margin: 0 !important;
  padding: 0 !important;
  font-size: 14px;
  color: #333;
  font-weight: 400;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  line-height: 1.4;
}

/* Checked state styling */
.w-checkbox input:checked ~ .circle-checkbox,
.w-checkbox input:checked + span .circle-checkbox {
  background-color: #004AF5;
  border-color: #004AF5;
}

.w-checkbox input:checked ~ .circle-checkbox::after,
.w-checkbox input:checked + span .circle-checkbox::after {
  content: '✓';
  color: white;
  font-size: 14px;
  font-weight: bold;
}

/* Loading Preloader Styles */
.form-preloader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s ease;
}

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

.preloader-content {
  background: white;
  padding: 40px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  animation: slideUp 0.3s ease;
}

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

/* Spinner animation */
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #f0f0f0;
  border-top: 4px solid #004AF5;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

/* Preloader text */
.preloader-content p {
  margin: 0;
  color: #333;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* Form input focus states */
.form-input-field:focus,
.form-input-field.is-circle:focus {
  outline: none;
  border-color: #004AF5;
  box-shadow: 0 0 0 3px rgba(0, 74, 245, 0.1);
  transition: all 0.3s ease;
}

.form-input-field.is-circle-select:focus,
.w-select:focus {
  outline: none;
  border-color: #004AF5;
  box-shadow: 0 0 0 3px rgba(0, 74, 245, 0.1);
  transition: all 0.3s ease;
}

/* Field wrapper styling */
.field-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.field-label.hide {
  display: none;
}

/* Input field base styles */
.form-input-field {
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  transition: all 0.3s ease;
  background-color: #fff;
}

.form-input-field:hover {
  border-color: #004AF5;
}

.form-input-field::placeholder {
  color: #b4b4b4;
}

/* Select field styling */
.form-input-field.is-circle-select,
.w-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23004AF5' d='M10.293 3.293L6 7.586 1.707 3.293A1 1 0 00.293 4.707l5 5a1 1 0 001.414 0l5-5a1 1 0 10-1.414-1.414z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 36px;
}

/* Validation error styling */
.form-input-field.error,
.form-input-field.is-circle.error {
  border-color: #F43F5E;
  background-color: rgba(244, 63, 94, 0.05);
}

.form-input-field.error:focus,
.form-input-field.is-circle.error:focus {
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.1);
}

/* Success styling */
.form-input-field.success,
.form-input-field.is-circle.success {
  border-color: #10B981;
  background-color: rgba(16, 185, 129, 0.05);
}

.form-input-field.success:focus,
.form-input-field.is-circle.success:focus {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* reCAPTCHA styling */
#recaptcha-container {
  margin: 20px 0;
  padding: 16px;
  background-color: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Message containers */
#valid-msg {
  color: #10B981;
  font-size: 13px;
  margin-top: 4px;
  display: none;
}

#error-msg {
  color: #F43F5E;
  font-size: 13px;
  margin-top: 4px;
  display: none;
}

/* Success and error messages */
.form-success-message {
  display: none;
  padding: 30px;
  background-color: #f0f9ff;
  border: 1px solid #0ea5e9;
  border-radius: 8px;
  margin-top: 20px;
}

.form-success-message.active {
  display: block;
}

.error-message_wrap {
  display: none;
  padding: 16px;
  background-color: #fee2e2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  color: #991b1b;
  margin-top: 12px;
}

.error-message_wrap.active {
  display: block;
}

/* Button states during submission */
.circle_button.is-form-long:disabled,
.circle_button.is-form-long[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.circle_button.is-form-long.loading {
  pointer-events: none;
  opacity: 0.6;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .circle-form_fields {
    gap: 16px;
    margin-bottom: 24px;
  }

  .form-input-field {
    padding: 10px 12px;
    font-size: 13px;
  }

  .preloader-content {
    padding: 30px;
    margin: 20px;
  }

  .spinner {
    width: 40px;
    height: 40px;
    border-width: 3px;
  }

  .preloader-content p {
    font-size: 14px;
  }
}

/* Tablet adjustments */
@media (min-width: 641px) and (max-width: 1024px) {
  .circle-form_fields {
    gap: 18px;
  }

  .form-field-wrappper {
    gap: 18px;
  }
}

/* Animation for field entry */
.form-input-field,
.circle-form_option-wrap {
  animation: fieldFadeIn 0.4s ease;
}

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

/* Print styles */
@media print {
  .form-preloader {
    display: none !important;
  }

  .circle-form_fields {
    break-inside: avoid;
  }
}
