/* Form-Specific Styles */

/* Research Form Container */
.research-form {
  padding: 2rem;
  background: hsl(var(--background));
  border: 4px solid hsl(var(--border));
  box-shadow: var(--shadow-brutal-xl);
}

/* Form Row - Two columns on desktop */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Form Group */
.form-group {
  margin-bottom: 1.5rem;
}

.form-row .form-group {
  margin-bottom: 0;
}

.form-group:last-of-type {
  margin-bottom: 2rem;
}

/* Labels */
.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-family: 'Arial Black', 'Arial', sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  color: hsl(var(--foreground));
  letter-spacing: 0.5px;
}

/* Checkbox Group */
.checkbox-group {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.checkbox-group input[type="checkbox"] {
  margin-top: 0.25rem;
}

.checkbox-group label {
  flex: 1;
  font-family: 'Courier New', 'Courier', monospace;
  font-size: 0.875rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  line-height: 1.5;
  margin-bottom: 0;
}

/* Error message inside checkbox-group should appear on new line */
.checkbox-group .just-validate-error-label {
  flex-basis: 100%;
  margin-top: 0.5rem;
  margin-left: 0;
}

/* Privacy Policy Text */
.privacy-text {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.6;
  margin-top: 0.5rem;
}

/* Submit Button */
.research-form .btn {
  width: 100%;
  margin-top: 1rem;
  font-size: 1.125rem;
  padding: 1rem;
}

/* Validation Error Styles (Just-Validate) */
.just-validate-error-label {
  display: block;
  margin-top: 0.5rem;
  font-family: 'Courier New', 'Courier', monospace;
  font-size: 0.875rem;
  font-weight: 700;
  color: hsl(var(--destructive));
}

.is-invalid {
  border-color: hsl(var(--destructive)) !important;
  animation: shake 0.3s;
}

.is-valid {
  border-color: hsl(var(--success));
}

/* Shake Animation for Invalid Fields */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

/* Placeholder Styles */
input::placeholder,
textarea::placeholder {
  color: hsl(0 0% 40%); /* Darker gray for better readability */
  opacity: 1;
}

/* Character Counter (Optional Enhancement) */
.char-counter {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  text-align: right;
}

/* Honeypot Field - Hidden from real users, catches bots */
.honeypot-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Disabled State */
input:disabled,
textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: hsl(0 0% 95%);
}

/* Success Message Styling */
.success-message {
  padding: 3rem 2rem;
  text-align: center;
  background: hsl(120 100% 95%);
  border: 4px solid hsl(120 60% 50%);
  box-shadow: var(--shadow-brutal-lg);
}

.success-message .success-icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  animation: pop-in 0.4s ease-out;
}

.success-message h2 {
  margin-bottom: 1rem;
  color: hsl(var(--foreground));
}

.success-message p {
  font-size: 1.125rem;
  line-height: 1.7;
  color: hsl(var(--foreground));
  margin-bottom: 0.5rem;
}

.success-message p:last-child {
  font-weight: 700;
  margin-top: 1.5rem;
}

/* Pop-in Animation for Success */
@keyframes pop-in {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Loading State for Form */
.research-form.loading {
  pointer-events: none;
  opacity: 0.6;
}

.research-form.loading .btn {
  position: relative;
}

.research-form.loading .btn::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  right: 1rem;
  margin-top: -8px;
  border: 3px solid hsl(var(--main-foreground));
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Responsive Form Styles */
@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .form-row .form-group {
    margin-bottom: 0;
  }
}

@media (max-width: 480px) {
  .research-form {
    padding: 1.5rem;
  }

  .form-group {
    margin-bottom: 1.25rem;
  }

  .research-form .btn {
    font-size: 1rem;
    padding: 0.875rem;
  }

  .success-message {
    padding: 2rem 1.5rem;
  }

  .success-message .success-icon {
    font-size: 3rem;
  }

  .success-message p {
    font-size: 1rem;
  }
}

/* Focus Visible Enhancement */
input:focus-visible,
textarea:focus-visible,
.btn:focus-visible {
  outline: 3px solid hsl(var(--ring));
  outline-offset: 3px;
}

/* Autofill Styles */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0px 1000px hsl(60 100% 95%) inset;
  -webkit-text-fill-color: hsl(var(--foreground));
  border-color: hsl(var(--main));
}
