form.search-form {
  display: flex;
  flex-direction: row;
}
form.search-form .form-type-search {
  flex: 0 1 100%;
}
form.contact-form,
form.user-login-form {
  margin: 0 auto;
  max-width: 600px;
}
form.webform-submission-contact-us-form {
  margin: 0 auto;
  max-width: 100%;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="address"],
input[type="tel"],
input[type="number"],
input[type="search"],
textarea,
select {
  background-color: var(--white) !important;
  border: solid 1px var(--greyDarker) !important;
  border-radius: 8px !important;
  color: var(--textColor) !important;
  font-family: var(--font-family-ui);
  font-size: var(--font-size-input);
  line-height: var(--line-height-relaxed) !important;
  margin: 0;
  min-width: 250px;
  padding: var(--space-md) 1.2rem !important;
  /* height: 2.75rem !important; Uniform height for all fields */
  width: 100%;
}
select {
  padding-right: 3rem !important; /* Space for arrow */
  -webkit-appearance: none; /* Hide default arrow on WebKit browsers */
  appearance: none; /* Hide default arrow on other browsers */
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px 12px;
}

textarea {
  height: auto;
  min-height: 10rem;
}

input[type="checkbox"],
input[type="radio"] {
  -webkit-appearence: none;
  appearance: none;
  background-color: var(--greyLight);
  border: solid 1px var(--greyDarker);
  border-radius: 30px;
  height: 1.5rem;
  margin: 0;
  vertical-align: middle;
  width: 1.5rem;
}
input[type="checkbox"]:checked,
input[type="radio"]:checked {
  -webkit-appearance: none;
  appearance: none;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%23fff" class="bi bi-check" viewBox="0 0 16 16"><path d="M10.97 4.97a.75.75 0 0 1 1.07 1.05l-3.99 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425a.267.267 0 0 1 .02-.022z"/></svg>'), var(--qridaOrange);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 1rem;
}
input.required.error {
  border: solid 1px var(--red) !important;
}

/* Styling for Webform inline error messages */
.webform-submission-form strong.error.form-item--error-message {
  display: block;
  background-color: var(--messages-error-bg, #fef2f2); /* Fallback to default red if variable not found */
  border: 1px solid var(--messages-error-border, #ef4444); /* Fallback to default red if variable not found */
  color: var(--messages-error-color, #991b1b); /* Fallback to default red if variable not found */
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  margin-top: 0.5rem; /* Adjust spacing below the field */
  white-space: normal; /* Ensure text wraps and doesn't get ellipsis */
  overflow: visible; /* Ensure content is not clipped */
  text-overflow: clip; /* Prevent ellipsis on overflow */
}

.form-item.js-form-type-tel + strong.error.form-item--error-message {
  margin-top: 0.5rem !important; /* Override negative margin from other modules */
}

input[type="submit"] {
  background-color: var(--qridaOrange);
  background-image: none;
  background-position: center;
  background-repeat: no-repeat;
  border: solid 1px transparent;
  border-radius: 8px;
  color: var(--white);
  font-family: var(--font-family-ui);
  font-size: var(--font-size-button);
  height: 100%;
  line-height: 1.25;
  margin: 0 !important;
  padding: var(--space-md) var(--space-2xl) !important;
}
form.search-form input[type="search"] {
  -webkit-appearance: none;
  appearance: none;
  border-right: none !important;
  border-radius: 8px 0 0 8px !important;
  min-width: 280px;
}
form.search-form input[type="submit"] {
  -webkit-appearance: none;
  appearance: none;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%23fff" class="bi bi-search" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/></svg>'), var(--qridaOrange);
  background-position: center;
  background-repeat: no-repeat;
  border: solid 1px var(--qridaOrange);
  border-radius: 0 8px 8px 0;
  font-size: 0rem;
  height: 100%;
  line-height: 1;
  margin: 0 !important;
  padding: 0.5rem 1.5rem;
}

.views-exposed-form .js-form-item-field-region-target-id {
  padding: 0 !important;
}
.half-width {
  width: 50% !important;
}

.form-url {
  border-radius: 8px !important;
}

.form-select {
  line-height: 18px !important;
}

.webform-telephone--wrapper .fieldset__wrapper {
      display: flex;
      align-items: center;

  .form-type-number label {
    display: none;
  }
}

input.form-color.form-color-medium {
  min-height: 32px;
}

.views-exposed-form select,
.webform-submission-contact-us-form select {
  background-color: var(--greyLighter);
  background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="25" height="16" fill="%23A85604" class="bi bi-chevron-down" viewBox="0 0 25 16"><path class="st0" d="M0,0v16h25V0H0z M16.8,6.3l-4.3,4.4L8.2,6.3C8,6.2,8,5.8,8.2,5.7c0.2-0.2,0.5-0.2,0.7,0l3.7,3.6l3.7-3.6 c0.2-0.2,0.5-0.2,0.7,0C17,5.8,17,6.2,16.8,6.3z"/></svg>');
  background-position: center right;
  background-repeat: no-repeat;
  background-size: contain;
  line-height: 1;
  max-width: 500px;
  overflow: hidden;
  padding: 0.5rem 5rem 0.5rem 0.75rem !important;
}
.views-exposed-form input[data-drupal-selector="edit-reset"] {
  background-color: var(--greyDarker);
  margin: 1rem 0 0 0 !important;
}

.webform-title {
  color: var(--qridaOrange);
  font-family: var(--font-family-headings);
  font-size: var(--font-size-h4);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-snug);
  margin: 0 0 var(--space-2xl) 0;
  text-transform: none;
  letter-spacing: var(--letter-spacing-normal);
}

form.webform-submission-subscribe-newsletter-form .messages__wrapper {
  padding: 0;
}
form.webform-submission-subscribe-newsletter-form .messages.messages--info {
  background-color: #f0f8ff !important;
  border: 1px solid #3b82f6 !important;
  border-radius: 6px !important;
  color: #1e40af !important;
  font-size: 0.85rem !important;
  line-height: 1.4 !important;
  margin: 1rem 0 !important;
  padding: 0.75rem !important;
  max-height: 120px !important;
  overflow-y: auto !important;
}
form.webform-submission-contact-us-form .webform-confirmation__message {
  color: var(--qridaOrange);
}
/* Tablet */
@media only screen and (min-width: 768px) {
  .views-exposed-form input[data-drupal-selector="edit-reset"] {
    margin: 0 0 0 0.6rem !important;
  }
  form.webform-submission-contact-us-form .webform-confirmation__message {
    color: var(--qridaOrange);
    font-size: 1.5rem;
  }
}
/* Large desktop */
@media screen and (min-width: 1200px) {
}
/* Extra large desktop */
@media screen and (min-width: 1400px) {
}
/* HD desktop */
@media screen and (min-width: 1920px) {
}
@media (pointer: fine) {
  input[type="text"]:hover,
  input[type="email"]:hover,
  input[type="password"]:hover,
  input[type="address"]:hover,
  input[type="tel"]:hover,
  input[type="number"]:hover,
  textarea:hover,
  select:hover {
    border-color: var(--qridaOrange) !important;
    outline: none !important;
  }
  input[type="submit"]:hover {
    background-color: var(--orangeLighter);
    border: solid 1px transparent;
  }
  input[type="submit"]:active {
    background-color: var(--qridaOrange);
    transform: translateY(1px);
  }
  form.search-form input[type="submit"]:hover,
  form.search-form input[type="submit"]:focus {
    background-color: var(--orangeLighter);
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%23fff" class="bi bi-search" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/></svg>');
    background-repeat: no-repeat;
  }
}

#captcha summary,
#captcha .details-wrapper {
  background-color: transparent;
  padding: 0.75rem 1.8rem;
}

#captcha summary::marker {
  content: "";
}

/* Paragraph forms in sidebar */
.paragraph-text-resources-form .col-xl-3 input[type="text"],
.paragraph-text-resources-form .col-xl-3 input[type="email"],
.paragraph-text-resources-form .col-xl-3 input[type="password"],
.paragraph-text-resources-form .col-xl-3 input[type="address"],
.paragraph-text-resources-form .col-xl-3 input[type="tel"],
.paragraph-text-resources-form .col-xl-3 input[type="number"],
.paragraph-text-resources-form .col-xl-3 input[type="search"],
.paragraph-text-resources-form .col-xl-3 textarea,
.paragraph-text-resources-form .col-xl-3 select,
.paragraph-text-info .col-xl-3 input[type="text"],
.paragraph-text-info .col-xl-3 input[type="email"],
.paragraph-text-info .col-xl-3 input[type="password"],
.paragraph-text-info .col-xl-3 input[type="address"],
.paragraph-text-info .col-xl-3 input[type="tel"],
.paragraph-text-info .col-xl-3 input[type="number"],
.paragraph-text-info .col-xl-3 input[type="search"],
.paragraph-text-info .col-xl-3 textarea,
.paragraph-text-info .col-xl-3 select {
  min-width: unset !important;
  max-width: 100% !important;
}

.paragraph-text-resources-form .col-xl-3 .webform-submission-form,
.paragraph-text-info .col-xl-3 .webform-submission-form {
  background-color: var(--white);
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(0,0,0,0.08);
  margin-top: 1.5rem;
  padding: 1.5rem;
}

.paragraph-text-resources-form .col-xl-3 .webform-title,
.paragraph-text-info .col-xl-3 .webform-title {
  margin-bottom: 1rem;
}

/* Entity Moderation Module */
#content-moderation-entity-moderation-form .entity-moderation-form input[type=submit] {
    margin-bottom: 1em !important;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="address"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus,
input[type="checkbox"]:focus,
input[type="radio"]:focus {
  outline: 2px solid var(--qridaOrange) !important;
  outline-offset: 1px;
}

legend,
.fieldset-legend,
label.form-item__label {
  font-family: var(--font-family-ui);
  font-weight: var(--font-weight-bold);
  margin: 0 0 var(--space-xs) 0; /* Consolidate margin property to control all sides, ensuring consistency */
  font-size: var(--font-size-label);
}

/* Ensure consistent styling for required labels overriding potential Gin theme styles */
/* This rule targets labels specifically marked as required, applying !important to ensure override */
label.form-item__label.form-required,
.fieldset-legend.form-required { /* Added fieldset-legend for consistency with fieldset titles */
  margin: 0 0 0.25rem 0 !important; /* Override with consistent margin */
  font-size: 0.929em !important; /* Override with consistent font-size */
  vertical-align: middle !important; /* Ensure vertical alignment of label text */
}

/* Remove any margin on the required asterisk pseudo-element */
.form-item__label.form-required::after,
.fieldset__label.form-required::after {
  margin-inline: 0 !important; /* Explicitly remove inline margin from the asterisk */
}

/* Fieldset styling */
fieldset {
  border: none;
  padding: 0;
  margin-bottom: 1.5rem;
}

legend,
.fieldset-legend {
  font-family: var(--font-family-headings);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-h5);
  padding: 0;
  margin: 0 0 var(--space-lg) 0;
  color: var(--greyDarker);
  width: auto;
}

/* Ensure specific legend padding as requested */
#edit-identity-disclosure--wrapper-legend {
  padding: 0.75rem 1.25rem !important;
}

.form-item {
  margin-bottom: 1.5rem;
}

.form-actions {
  display: flex;
  justify-content: center;
}

/* Flexbox for inline form elements */
.form--inline {
  display: flex;
  flex-wrap: wrap;
  margin: 0; /* Changed from 0 -0.75rem to 0 to prevent overflow caused by negative margin */
  align-items: flex-start;
}

.form--inline .form-item {
  padding: 0 0.75rem;
  flex: 1 1 auto;
}
.form--inline .form-item label {
  margin: 0 0 0.25rem 0 !important;
}
.form--inline .form-item-state-territory,
.form--inline .form-item-postcode {
  flex: 1 1 45%;
}

.webform-submission-form .form-item {
  margin-bottom: 2rem;
}

.webform-submission-form fieldset.fieldset {
  margin-top: 2rem;
}

.form-item label,
.form-wrapper .label {
  font-size: 0.929em;
}
.form-item-state-territory label {
  /* Margin handled by generic label rule */
}

/* Target the inner span within the legend to remove its default/inherited margins */
fieldset legend span.fieldset__label {
  margin: 0 !important; /* Force remove any margins that make the span appear larger */
  padding: 0 !important; /* Ensure no internal padding contributes to the size */
  display: inline; /* Keep text flow natural, or use block if single line */
  line-height: inherit; /* Inherit line-height from parent for consistent text height */
}

/* Fix Contact Us form: make State/territory and Postcode equal width */
#edit-state-postcode.webform-flexbox > .webform-flex {
  flex: 0 0 50%;
  max-width: 50%;
}

/* --- Contact Us: State/Territory and Postcode equal width, robust flex fix --- */
form.webform-submission-contact-us-form #edit-state-postcode.webform-flexbox {
  display: flex;
  gap: 1rem;
}
form.webform-submission-contact-us-form #edit-state-postcode.webform-flexbox > .form-item-state-territory,
form.webform-submission-contact-us-form #edit-state-postcode.webform-flexbox > .form-item-postcode {
  flex: 1 1 0;
  min-width: 0;
  max-width: 100%;
}
@media (max-width: 600px) {
  form.webform-submission-contact-us-form #edit-state-postcode.webform-flexbox {
    flex-direction: column;
    gap: 0;
  }
}
