/**
 * @file
 * Form + search styling for the Save Mo Lives theme.
 */

label,
.form-item__label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--sml-black);
  font-weight: 700;
  font-size: 0.95rem;
}

input[type='text'],
input[type='search'],
input[type='email'],
input[type='tel'],
input[type='number'],
input[type='password'],
input[type='url'],
input[type='date'],
textarea,
select,
.form-text,
.form-element {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--sml-border);
  border-radius: 4px;
  background: var(--sml-white);
  color: var(--sml-black);
  font-family: var(--sml-font-body);
  font-size: 1rem;
  line-height: 1.4;
}

input:focus,
textarea:focus,
select:focus,
.form-element:focus {
  border-color: var(--sml-orange);
  outline: 2px solid rgba(239, 71, 39, 0.25);
  outline-offset: 0;
}

textarea {
  min-height: 140px;
  resize: vertical;
}

select.form-element {
  appearance: none;
  background-color: var(--sml-white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 512'%3E%3Cpath fill='%23000' d='M137.4 374.6c12.5 12.5 32.8 12.5 45.3 0l128-128c9.2-9.2 11.9-22.9 6.9-34.9s-16.6-19.8-29.6-19.8L32 192c-12.9 0-24.6 7.8-29.6 19.8s-2.2 25.7 6.9 34.9l128 128z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 12px;
  padding-right: 2rem;
}

/* ---------------------------------------------------------------------------
 * Search exposed forms (header / footer / mobile).
 * ------------------------------------------------------------------------- */
.views-exposed-form .form--inline,
.views-exposed-form form {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.search-result-form-wrapper {
  display: flex;
  width: 100%;
  align-items: stretch;
}

/* Custom search input group (form-element--search.html.twig). */
.input-group {
  position: relative;
  display: flex;
  width: 100%;
  align-items: stretch;
}

.input-group .form-control,
.input-group input[type='search'] {
  flex: 1;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-group-append {
  display: flex;
}

.input-group-text {
  display: flex;
  align-items: center;
}

.search-submit-button {
  display: flex;
  height: 100%;
  align-items: center;
  padding: 0 0.9rem;
  border: 1px solid var(--sml-orange);
  border-left: 0;
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
  background: var(--sml-orange);
  color: var(--sml-white);
  cursor: pointer;
}

.search-submit-button:hover {
  background: var(--sml-black);
}

.search-submit-button .fa,
.search-submit-button i {
  color: var(--sml-white);
}

/* The default views search submit button sits to the right of the field. */
.views-exposed-form .form-actions {
  display: flex;
  align-items: flex-end;
  margin-left: 0.5rem;
}

.views-exposed-form .form-actions .button {
  white-space: nowrap;
}

/* Error messaging. */
.form-item--error-message {
  margin-top: 0.5rem;
  color: var(--sml-error);
  font-size: 0.875rem;
}

/* Desktop header search is a compact affordance in the Figma header. */
.sml-header-search .js-form-item-search-api-fulltext,
.sml-header-search .form-item,
.sml-header-search .search-result-form-wrapper {
  position: absolute;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  width: 1px;
  height: 1px;
  white-space: nowrap;
}

.sml-header-search .views-exposed-form,
.sml-header-search .block__content,
.sml-header-search form,
.sml-header-search .form--inline,
.sml-header-search .form-actions {
  width: 100%;
  height: 100%;
  margin: 0;
}

.sml-header-search .form-actions {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 64px;
  margin: 0;
  background: var(--sml-gray);
}

/* Higher-specificity (0,3,0) override: form.css loads last and its
 * .form--inline .form-actions rule (0,2,0) would otherwise push the
 * search button 27px below the top of the white header bar. */
.sml-header-search .form--inline .form-actions {
  margin-top: 0;
}

.sml-header-search .form-actions::before {
  content: '';
  width: 20px;
  height: 20px;
  margin-right: 0;
  background: no-repeat center / contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath fill='%23000' d='M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0s208 93.1 208 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z'/%3E%3C/svg%3E");
}

.sml-header-search .form-actions .button,
.sml-header-search .form-actions input[type='submit'] {
  width: auto;
  height: auto;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--sml-black);
  font-family: var(--sml-font-jost);
  font-weight: 700;
  font-size: 1.125rem;
  line-height: 1;
}

.sml-header-search.is-open .js-form-item-search-api-fulltext,
.sml-header-search.is-open .search-result-form-wrapper {
  overflow: visible;
  clip: auto;
  width: auto;
  height: auto;
  white-space: normal;
}

.sml-header-search.is-open .form-item {
  overflow: visible;
  clip: auto;
  width: 100%;
  height: auto;
  white-space: normal;
}

.sml-header-search.is-open .input-group input[type='search'] {
  height: 43px;
  padding: 0 3rem 0 1.25rem;
  border: 3px solid var(--sml-black);
  border-radius: 5px;
  color: var(--sml-black);
  font-family: var(--sml-font-body);
  font-size: 1rem;
}

.sml-header-search.is-open .input-group input[type='search']::placeholder {
  color: var(--sml-black);
  opacity: 1;
}

.sml-header-search.is-open .input-group-append {
  position: absolute;
  top: 30px;
  right: 25px;
  bottom: auto;
  height: 43px;
}

.sml-header-search.is-open .input-group-text {
  height: 100%;
  background: transparent;
}

.sml-header-search.is-open .search-submit-button {
  width: 3.5rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--sml-black);
  justify-content: center;
}

.sml-header-search.is-open .search-submit-button:hover,
.sml-header-search.is-open .search-submit-button:focus {
  background: transparent;
}

.sml-header-search.is-open .search-submit-button .fa,
.sml-header-search.is-open .search-submit-button i {
  color: var(--sml-black);
}

/* Mobile search: placeholder-only field, no visible label (Figma). */
.mobile-dropdown-search {
  background: var(--sml-white);
  border-bottom: 1px solid var(--sml-orange);
}

.mobile-dropdown-search label.search_label,
.mobile-dropdown-search .form-item__label,
.mobile-dropdown-search .js-form-item-search-api-fulltext > label {
  display: none;
}

.mobile-dropdown-search .input-group input[type='search']::placeholder {
  color: var(--sml-black);
  opacity: 1;
}
