/**
 * @file
 * Webform-CiviCRM integration styling for CAGP theme.
 * Updated for Drupal 11 + Webform 6.x + CiviCRM 6.6
 */

/* Main form container */
.webform-submission-form {
  max-width: 800px;
  margin: 0 auto;
}

/* Fieldset Styling - Main sections */
fieldset.webform-type-fieldset,
.js-webform-type-fieldset {
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 25px;
  background: #fafafa;
}

fieldset.webform-type-fieldset legend,
.js-webform-type-fieldset legend {
  font-size: 18px;
  font-weight: bold;
  color: #2786c2;
  padding: 0 10px;
  margin-bottom: 15px;
  background: white;
}

/* Form Items - Field spacing and layout */
.form-item,
.js-form-item {
  margin-bottom: 20px;
  clear: both;
}

/* Labels */
.form-item label,
.js-form-item label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: #333;
  font-size: 15px;
  line-height: 1.4;
}

/* Required field indicators */
.form-required::after,
.js-form-required::after {
  content: " *";
  color: #dc3545;
  font-weight: bold;
}

/* Text inputs, email, tel, url */
.form-text,
.form-email,
.form-tel,
.form-url,
.form-number,
.form-search,
.form-select,
.form-textarea {
  width: 100%;
  max-width: 500px;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1.5;
  background: white;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Select dropdowns specific width */
.form-select {
  height: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23333' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  padding-right: 30px;
  appearance: none;
}

/* Focus states */
.form-text:focus,
.form-email:focus,
.form-tel:focus,
.form-url:focus,
.form-number:focus,
.form-search:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: #2786c2;
  outline: none;
  box-shadow: 0 0 0 2px rgba(39, 134, 194, 0.2);
}

/* Radio and Checkbox groups */
.form-type-radio,
.form-type-checkbox,
.js-form-type-radio,
.js-form-type-checkbox {
  margin-bottom: 10px;
}

.form-type-radio label,
.form-type-checkbox label,
.js-form-type-radio label,
.js-form-type-checkbox label {
  display: inline-block;
  margin-left: 8px;
  font-weight: normal;
  cursor: pointer;
}

/* Radio/Checkbox fieldsets */
.radios--wrapper,
.checkboxes--wrapper {
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 15px;
  background: white;
  margin-bottom: 20px;
}

.radios--wrapper legend,
.checkboxes--wrapper legend {
  font-weight: 600;
  color: #333;
  font-size: 15px;
  padding: 0 10px;
  background: white;
}

/* Radio/checkbox inputs */
input[type="radio"],
input[type="checkbox"] {
  margin-right: 8px;
  margin-top: 2px;
  vertical-align: top;
}

/* CiviCRM specific field styling */
[id*="civicrm-"] .form-item {
  margin-bottom: 18px;
}

/* Address fields grouped styling */
[name*="address"] {
  margin-bottom: 15px;
}

/* Province/Country dropdowns */
[name*="state_province"],
[name*="country"] {
  max-width: 300px;
}

/* Professional details section */
#edit-professional-details .form-type-radio {
  margin-bottom: 15px;
  padding: 10px;
  background: white;
  border-radius: 4px;
}

/* Submit button */
.form-actions {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 2px solid #e0e0e0;
  text-align: center;
}

.webform-button--submit,
.form-submit {
  background: #2786c2;
  color: white;
  padding: 12px 40px;
  font-size: 16px;
  font-weight: bold;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.webform-button--submit:hover,
.form-submit:hover {
  background: #1e6ba8;
}

/* Error messages */
.form-item--error-message,
.error {
  color: #dc3545;
  font-size: 13px;
  margin-top: 5px;
}

input.error,
select.error,
textarea.error {
  border-color: #dc3545;
}

/* Help text */
.description,
.form-item__description {
  font-size: 13px;
  color: #666;
  margin-top: 5px;
  line-height: 1.4;
}

/* Inline fields for smaller items */
.webform-flexbox {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.webform-flexbox .form-item {
  flex: 1;
  min-width: 200px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .webform-submission-form {
    padding: 0 15px;
  }

  fieldset.webform-type-fieldset {
    padding: 15px;
    margin-bottom: 20px;
  }

  .form-text,
  .form-email,
  .form-tel,
  .form-url,
  .form-select {
    max-width: 100%;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .webform-flexbox {
    flex-direction: column;
  }

  .form-actions {
    text-align: left;
  }

  .webform-button--submit {
    width: 100%;
  }
}

/* Specific membership form adjustments */
#webform-submission-membership-registration-node-61-add-form {
  padding: 20px 0;
}

#webform-submission-membership-registration-node-61-add-form fieldset {
  margin-bottom: 30px;
}

/* Contact information section */
#edit-contact-address input[type="text"] {
  margin-bottom: 12px;
}

/* Professional details radio groups */
#edit-mfa-p-designation,
#edit-united-way-employee,
#edit-ymca-employee {
  background: white;
  padding: 10px;
  border-radius: 4px;
}

/* Consent checkboxes */
#edit-electronic-communications,
#edit-code-of-ethics {
  background: #f8f9fa;
  padding: 12px;
  border-left: 3px solid #2786c2;
  margin-bottom: 15px;
}

/* Chapter selection */
#edit-chapter {
  max-width: 400px;
}

/* Loading states */
.webform-submission-form.form-disabled {
  opacity: 0.6;
  pointer-events: none;
}

/* Progress indicator for multi-step forms */
.webform-progress {
  margin-bottom: 30px;
}

.webform-progress__bar {
  background: #e0e0e0;
  height: 20px;
  border-radius: 10px;
  overflow: hidden;
}

.webform-progress__bar-fill {
  background: #2786c2;
  height: 100%;
  transition: width 0.3s ease;
}

/* Validation summary */
.messages--error {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
  padding: 15px;
  margin-bottom: 20px;
  color: #721c24;
}

/* Success message */
.messages--status {
  background: #d4edda;
  border: 1px solid #c3e6cb;
  border-radius: 4px;
  padding: 15px;
  margin-bottom: 20px;
  color: #155724;
}