/* Form Service Styles - Based on Figma Design */

:root {
  --form-primary-color: #3E6AE1;
  --form-secondary-color: #3E6AE1;
  --form-text-dark: #2A1A46;
  --form-text-grey: #9AA8AE;
  --form-error-color: #E83892;
  --form-bg-grey: #F6F6F6;
  --form-border-color: #9C9AAE;
}

/* Form Container */
.th-form-wrapper,
.th-form-wrapper {
  background: #ffffff;
  max-width: 710px;
  margin: 0 auto;
}

/* Form Header */
.form-header {
  text-align: center;
  margin-bottom: 42px;
}

.form-title {
  font-family: 'Roboto', sans-serif;
  font-weight: bold;
  font-size: 28px;
  color: var(--form-text-dark);
  line-height: 1.2;
  margin-bottom: 16px;
  margin-top: 0;
}

.form-subtitle {
  font-family: 'Roboto', sans-serif;
  font-weight: normal;
  font-size: 16px;
  color: var(--form-text-grey);
  line-height: 1.4;
  max-width: 100%;
  margin-bottom: 0;
  margin-top: 0;
}

/* Legacy classes for backwards compatibility */
.th-form-header {
  text-align: center;
  margin-bottom: 42px;
}

.th-form-title {
  font-family: 'Roboto', sans-serif;
  font-weight: bold;
  font-size: 28px;
  color: var(--form-text-dark);
  line-height: 1.2;
  margin-bottom: 16px;
}

.th-form-description {
  font-family: 'Roboto', sans-serif;
  font-weight: normal;
  font-size: 16px;
  color: var(--form-text-grey);
  line-height: 1.4;
  max-width: 100%;
}

/* Form Body */
.th-form-body {
  width: 100%;
}

.th-form-body form {
  grid-template-columns: 1fr 1fr;
  gap: 16px;

  div.th-form-group:not(:last-child) {
    margin-bottom: 1em;
  }

  div.th-form-checkbox-group {
    margin-top: 1em;
  }

  div.th-form-html {
    text-align: center;
  }
  
  img {
    max-width: 100%;
  }
}

/* Form Groups */
.th-form-group,
.th-form-group {
  position: relative;
  grid-column: 1 / -1;
}

/* Firstname and Lastname in 2 columns */
.th-form-group[data-field-name="field_firstname"],
.th-form-group[data-field-name="field_lastname"] {
  grid-column: span 1;
}

/* Email and Phone in 2 columns */
.th-form-group[data-field-name="field_email"],
.th-form-group[data-field-name="field_phone"] {
  grid-column: span 1;
}

/* Form Inputs */
.th-form-input,
.th-form-textarea,
.th-form-input,
.th-form-textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #686e77;
  border-radius: 3px;
  background-color: white;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  line-height: 1.4;
  color: #112337;
  transition: border-color 0.3s ease;
  outline: none;
}

.th-form-input::placeholder,
.th-form-textarea::placeholder,
.th-form-input::placeholder,
.th-form-textarea::placeholder {
  color: rgba(17, 35, 55, 0.65);
  font-size: 16px;
}

.th-form-input:focus,
.th-form-textarea:focus {
  border-color: #686e77;
  box-shadow: none;
}

/* Labels */
.th-form-label {
  display: flex;
  align-items: center;
  gap: 4px;
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  transition: all 0.3s ease;
  font-family: 'Roboto', sans-serif;
  font-size: 16px;
  color: var(--form-text-grey);
  background: #ffffff;
  padding: 0 4px;
}

.th-form-textarea + .th-form-label {
  top: 16px;
  transform: translateY(0);
}

/* Floating label effect */
.th-form-group.has-value .th-form-label,
.th-form-group.focused .th-form-label {
  top: 0;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--form-secondary-color);
}

/* Required asterisk */
.required-asterisk {
  color: var(--form-error-color);
  font-weight: bold;
  font-size: 16px;
}

/* Optional tag */
.optional-tag {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-family: 'Inter', 'Roboto', sans-serif;
  font-size: 16px;
  color: var(--form-text-grey);
  pointer-events: none;
  background: #ffffff;
  padding: 0 4px;
  z-index: 1;
}

.th-form-textarea ~ .optional-tag {
  top: 16px;
  transform: translateY(0);
}

/* Select dropdown - styled like .form-select */
select.th-form-input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.83333 8.33333L10 12.5L14.1667 8.33333' stroke='%239AA8AE' stroke-width='1.66667' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 48px;
}

/* Textarea specific */
.th-form-textarea {
  min-height: 240px;
  resize: vertical;
  padding-top: 16px;
}

/* File Upload */
.th-form-upload {
  background: var(--form-bg-grey);
  border: 1px solid var(--form-border-color);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.th-form-upload-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: 'Roboto', sans-serif;
  font-size: 16px;
  color: var(--form-text-grey);
}

.th-form-upload-btn {
  background: var(--form-secondary-color);
  color: #ffffff;
  border: none;
  border-radius: 4px;
  padding: 9px 16px;
  font-family: 'Roboto', sans-serif;
  font-weight: bold;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.th-form-upload-btn:hover {
  background: #239BB8;
}

.th-form-upload input[type="file"] {
  display: none;
}

/* Upload hint */
.upload-hint {
  font-family: 'Roboto', sans-serif;
  font-style: italic;
  font-size: 14px;
  color: var(--form-text-grey);
  line-height: 1.4;
  margin-bottom: 16px;
}

.upload-hint strong {
  font-weight: bold;
}

/* Example section */
.example-section {
  margin: 20px 0;
}

.example-label {
  font-family: 'Roboto', sans-serif;
  font-size: 16px;
  color: #000000;
  margin-bottom: 8px;
}

.example-image {
  width: 100%;
  max-width: 559px;
  height: auto;
  border-radius: 8px;
  margin: 10px 0;
}

/* Checkbox */
.th-form-checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  grid-column: 1 / -1;
}

/*.th-form-checkbox {
  position: relative;
  width: 20px;
  height: 20px;
  min-width: 20px;
  background: var(--form-bg-grey);
  border: 1px solid var(--form-border-color);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
}*/

/*.th-form-checkbox input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  margin: 0;
}

.th-form-checkbox input[type="checkbox"]:checked + .checkbox-icon {
  opacity: 1;
}

.th-form-checkbox:hover {
  border-color: var(--form-secondary-color);
}*/

/*.checkbox-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  opacity: 0;
  transition: opacity 0.3s ease;
}*/

/*.checkbox-icon::before {
  content: '✓';
  color: var(--form-secondary-color);
  font-size: 14px;
  font-weight: bold;
  position: absolute;
  top: -8px;
  left: -3px;
}*/

.checkbox-label {
  font-family: 'Roboto', sans-serif;
  font-size: 16px;
  color: #000000;
  line-height: 1.4;
}

.checkbox-label a {
  color: var(--form-secondary-color);
  font-weight: bold;
  text-decoration: none;
}

.checkbox-label a:hover {
  text-decoration: underline;
}

/* Required fields note */
.required-note {
  font-family: 'Roboto', sans-serif;
  font-weight: 300;
  font-size: 12px;
  color: #000000;
  text-align: center;
  margin: 16px 0;
}

/* Submit Button */
.th-form-submit {
  text-align: center;
  padding: 16px 0;
  grid-column: 1 / -1;
}

.th-form-submit-btn {
  /*background: var(--form-primary-color);
  color: #ffffff;
  border: none;
  border-radius: 58px;
  padding: 16px 32px;
  font-family: 'Roboto', sans-serif;
  font-weight: bold;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 150px;*/
    background-color: var(--th-color-main-purple);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 16px 32px;
    font-family: 'Roboto', sans-serif;
    font-weight: 700;
    font-size: 16px;
    line-height: 14.3px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.th-form-submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 37, 99, 0.3);
    opacity: 0.9;
}

.th-form-submit-btn::before {
    content: "\f1d8";
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 14px;
}

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

/* Error states */
.th-form-group.has-error .th-form-input,
.th-form-group.has-error .th-form-textarea {
  border-color: var(--form-error-color);
}

.th-form-error {
  color: var(--form-error-color);
  font-size: 14px;
  margin-top: 4px;
  display: block;
}

/* Success message */
.th-form-success {
  background: #D4EDDA;
  border: 1px solid #C3E6CB;
  color: #155724;
  padding: 20px;
  border-radius: 8px;
  margin: 20px 0;
  text-align: center;
  font-size: 16px;
}

/* Loading state */
.th-form-loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
  vertical-align: middle;
  margin-left: 10px;
}

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

/* Responsive */
@media (max-width: 768px) {
  .th-form-wrapper {
    padding: 30px 15px;
  }

  .form-title,
  .th-form-title {
    font-size: 24px;
  }

  .form-subtitle,
  .th-form-description {
    font-size: 14px;
  }

  .th-form-input,
  .th-form-textarea,
  .th-form-label {
    font-size: 14px;
  }

  .th-form-submit-btn {
    width: 100%;
  }

  /* Single column on mobile */
  .th-form-body form {
    grid-template-columns: 1fr;
  }

  .th-form-group[data-field-name="field_firstname"],
  .th-form-group[data-field-name="field_lastname"],
  .th-form-group[data-field-name="field_email"],
  .th-form-group[data-field-name="field_phone"] {
    grid-column: 1;
  }
}

