/**
 * Contract Form Styles
 *
 * This stylesheet provides form-specific styling while inheriting
 * brand colors, fonts, and base styles from /styles.css
 *
 * Brand Colors (from parent stylesheet):
 * - Primary: #5E2A50 (purple)
 * - Background: #F4F1EA (cream)
 *
 * Fonts (from parent stylesheet):
 * - Headings: 'Clash Display', sans-serif
 * - Body: 'Bricolage Grotesque', sans-serif
 */

/* CSS custom property for smooth button animation */
@property --angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

/* Page Layout */
.contract-page {
  min-height: 100vh;
  background-color: #F4F1EA;
  padding: 2rem 1rem;
}

.form-container,
.signing-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 2.5rem;
  background: #FFFFFF;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(94, 42, 80, 0.1);
}

/* Headers */
.form-header,
.signing-header {
  text-align: center;
  margin-bottom: 4rem;
}

.form-header h1,
.signing-header h2 {
  font-family: 'Clash Display', sans-serif;
  font-weight: 600;
  color: #5E2A50;
  font-size: 2.5rem;
  line-height: 85%;
  letter-spacing: -0.025rem;
  margin: 2rem 0 2rem 0;
}

.form-header p,
.signing-header p {
  font-family: 'Bricolage Grotesque', sans-serif;
  color: #666;
  font-size: 1rem;
  line-height: 1.5;
}

/* Form Styling */
.contract-form {
  display: flex;
  flex-direction: column;
}

.field-wrap {
  width: 100%;
  min-width: 30%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  margin: 0 0 2rem 0;
}

.field-wrap label {
  font-family: 'Clash Display', sans-serif;
  color: #5E2A50;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 100%;
  letter-spacing: 0.02rem;
}

.field-wrap label .required {
  color: #D32F2F;
}

.field-wrap input {
  width: 100%;
  height: 3rem;
  padding: 0 1rem;
  border: 2px solid #F4F1EA;
  border-radius: 0.75rem;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1.25rem;
  font-weight: 400;
  margin: 1rem 0 0 0;
  transition: border-color 100ms ease;
  background-color: #FAFAFA;
  overflow-x: hidden;
  box-sizing: border-box;
}

.field-wrap input:focus {
  outline: none;
  border-color: #57C073;
  box-shadow: none;
  background-color: #FFFFFF;
}

/* Textarea field styling */
.field-wrap textarea {
  width: 100%;
  padding: 1rem;
  border: 2px solid #F4F1EA;
  border-radius: 0.75rem;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 135%;
  margin: 1rem 0 0 0;
  transition: border-color 100ms ease;
  background-color: #FAFAFA;
  box-sizing: border-box;
  resize: vertical;
}

.field-wrap textarea:focus {
  outline: none;
  border-color: #57C073;
  box-shadow: none;
  background-color: #FFFFFF;
}

.field-wrap textarea::placeholder {
  color: #5E2A50;
  opacity: 0.4;
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: 1.25rem;
  font-weight: 400;
}

/* Select field styling */
.field-wrap select {
  width: 100%;
  height: 3.5rem;
  padding: 0 2.5rem 0 1rem;
  border: 2px solid #E0E0E0;
  border-radius: 0.75rem;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1.25rem;
  font-weight: 400;
  margin: 1rem 0 0 0;
  transition: border-color 100ms ease;
  background-color: #FAFAFA;
  color: #5E2A50;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  overflow-x: hidden;
  cursor: pointer;
  box-sizing: border-box;
  /* Custom dropdown arrow */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%235E2A50' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 20px 20px;
}

.field-wrap select:focus {
  outline: none;
  border-color: #57C073;
  box-shadow: none;
  background-color: #FFFFFF;
}

/* Hide native arrow in IE/Edge */
.field-wrap select::-ms-expand {
  display: none;
}

/* Checkbox field styling */
.checkbox-wrap {
  margin: 1rem 0 2rem 0;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: #5E2A50;
}

.checkbox-label input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  max-width: 2rem;
  min-height: 2rem;
  max-height: 2rem;
  border: 2px solid #E0E0E0;
  border-radius: 0.5rem;
  background-color: #FAFAFA;
  cursor: pointer;
  position: relative;
  margin: 0.125rem 0 0 0;
  transition: all 100ms ease;
  box-sizing: border-box;
  flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:hover {
  border-color: #5E2A50;
}

.checkbox-label input[type="checkbox"]:focus {
  outline: none;
  border-color: #57C073;
  box-shadow: 0 0 0 3px rgba(87, 192, 115, 0.1);
}

.checkbox-label input[type="checkbox"]:checked {
  background-color: #5E2A50;
  border-color: #5E2A50;
}

.checkbox-label input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0.4rem;
  height: 0.75rem;
  border: solid #F4F1EA;
  border-width: 0 2.5px 2.5px 0;
  transform: translate(-50%, -60%) rotate(45deg);
}

.checkbox-text {
  flex: 1;
}

/* Placeholder styling */
.field-wrap input::placeholder {
  color: #5E2A50;
  opacity: 0.4;
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: 1.25rem;
  font-weight: 400;
}

/* Legacy placeholder fallbacks */
.field-wrap input::-webkit-input-placeholder {
  color: #5E2A50;
  opacity: 0.4;
}

.field-wrap input::-moz-placeholder {
  color: #5E2A50;
  opacity: 0.4;
}

.field-wrap input:-ms-input-placeholder {
  color: #5E2A50;
  opacity: 1;
}

.field-wrap input.invalid {
  border-color: #D32F2F;
}

.field-wrap input.invalid:focus {
  box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.1);
}

.field-hint {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  letter-spacing: 0.02rem;
  color: #999;
}

/* Turnstile Widget */
.turnstile-wrap {
  display: flex;
  justify-content: center;
  margin: 1rem 0;
}

/* Error Messages */
.error-message {
  padding: 1rem;
  background-color: #FFEBEE;
  border: 1px solid #EF5350;
  border-radius: 8px;
  color: #C62828;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 0.95rem;
  line-height: 1.4;
}

/* Submit Button */
.submit-btn {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  height: 3.5rem;
  padding: 0 1.5rem;
  margin: 2rem 0 0 0;
  background-color: #FFFFFF;
  color: #5E2A50;
  border: none;
  border-radius: 1.5rem;
  font-family: 'Clash Display', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.04rem;
  cursor: pointer;
  transition: color 0.3s ease;
}

.submit-btn .btn-text {
  flex-shrink: 0;
}

/* Animated gradient border */
.submit-btn::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 1.25rem;
  padding: 2px;
  background: conic-gradient(
    from var(--angle, 0deg),
    #57C073,
    #E3AD40,
    #5E2A50,
    #57C073
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  animation: smoothRotate 5s linear infinite;
}

.submit-btn:hover {
  color: #5E2A50;
  transform: translateY(-1px);
}

.submit-btn:hover::before {
  animation: smoothRotate 2s linear infinite;
}

.submit-btn:active {
  transform: translateY(0);
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.submit-btn:disabled::before {
  animation: none;
}

/* Button animation keyframe */
@keyframes smoothRotate {
  from { --angle: 0deg; }
  to { --angle: 360deg; }
}

/* Form Footer */
.form-footer {
  text-align: center;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 0.85rem;
  color: #999;
  margin-top: 0.5rem;
  line-height: 1.4;
}

/* DocuSeal Embedded Form */
docuseal-form {
  width: 100%;
  min-height: 80vh;
  display: block;
  border: 1px solid #E0E0E0;
  border-radius: 8px;
  overflow: hidden;
}

/* Tablet Responsive */
@media (min-width: 768px) and (max-width: 1024px) {
  .field-wrap {
    margin: 0 0 3rem 0;
  }

  .form-container {
    width: 85%;
  }

  .form-header h1,
  .signing-header h2 {
    font-size: 5rem;
    letter-spacing: -0.05rem;
  }
}

/* Mobile Responsive */
@media (max-width: 767px) {
  .contract-page {
    padding: 1rem 0.5rem;
  }

  .form-container,
  .signing-container {
    width: 85%;
    padding: 1.5rem;
    border-radius: 8px;
  }

  .form-header h1,
  .signing-header h2 {
    font-size: 3.5rem;
    letter-spacing: -0.035rem;
  }

  .field-wrap {
    margin: 0 0 2.25rem 0;
  }

  .field-wrap input,
  .field-wrap textarea {
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .submit-btn {
    font-size: 0.875rem;
  }
}

/* Loading State Animation */
.submit-btn:disabled::after {
  content: '';
  display: block;
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  border: 2px solid #5E2A50;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Print Styles */
@media print {
  .form-header,
  .submit-btn,
  .turnstile-wrap {
    display: none;
  }
}
