/*!
 * Copyright (c) 2025 Kenneth Raymond
 * All rights reserved.
 *
 * Part of the expertsincmt WordPress theme.
 * Do not copy, modify, or redistribute without permission.
 *
 * ------------------------------------------------------------
 * GLOSSARY — SEARCH FILTER UI
 * ------------------------------------------------------------
 * Brings the Glossary search bar in line with the Genes DB
 * filter's visual pattern: bordered card, visually-hidden label,
 * matching input/button styling and focus states.
 *
 * IMPORTANT — scoping:
 *   `.site-searchwrap` / `.site-search__*` classes are shared with
 *   Dorsal Root (dr-filter.php) and general Search (search-filter.php).
 *   Every rule in this file is scoped to
 *   form.site-search[data-loop="gl"] specifically so Dorsal Root and
 *   general Search continue to use their own styling, untouched.
 *
 * Scope:
 *   .site-searchwrap:has(form.site-search[data-loop="gl"])
 *   form.site-search[data-loop="gl"]
 */

/* Outer wrapper: widen to match genes-filter's card width */
.site-searchwrap:has(form.site-search[data-loop="gl"]) {
  max-width: 1180px;
  padding-inline: 12px;
}

/* Card */
form.site-search[data-loop="gl"] .site-search__bar {
  max-width: 1180px;
  margin-inline: auto;
  padding: 1.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 28px 0 28px 28px;
  box-shadow: 0 10px 30px rgb(14 42 84 / 5%);
}

/* Row: search field + actions side by side */
form.site-search[data-loop="gl"] .site-search__row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

form.site-search[data-loop="gl"] .site-search__field--input {
  flex: 1 1 320px;
  min-width: 320px;
  position: relative;
}

/* Label: visually hidden, still accessible (matches genes-filter) */
form.site-search[data-loop="gl"] .site-search__label {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Input */
form.site-search[data-loop="gl"] input[type="search"] {
  width: 100%;
  height: 48px;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid #d6d9de;
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  font-size: 15px;
  line-height: 1.2;
  outline: none;
  transition: box-shadow 0.12s ease, border-color 0.12s ease;
}

form.site-search[data-loop="gl"] input[type="search"]::placeholder {
  color: #8e97a3;
}

form.site-search[data-loop="gl"] input[type="search"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

/* Actions row */
form.site-search[data-loop="gl"] .site-search__actions {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: flex-end;
  margin-top: 0;
}

/* SEARCH button */
form.site-search[data-loop="gl"] .site-search__btn {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
  border-radius: 16px;
  padding: 0 1.5em;
  line-height: 1.2;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  height: auto;
  transition: background-color 0.15s ease, color 0.15s ease,
    border-color 0.15s ease, box-shadow 0.25s ease;
}

form.site-search[data-loop="gl"] .site-search__btn:hover,
form.site-search[data-loop="gl"] .site-search__btn:focus {
  background-color: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* RESET button */
form.site-search[data-loop="gl"] .site-search__reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 0 1.5em;
  line-height: 1.2;
  min-block-size: 48px;
  height: auto;
  border-radius: 16px;
  border: 1.5px solid #f1bbbb;
  background: #fff5f5;
  color: #8b1b1b;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease,
    border-color 0.15s ease;
}

form.site-search[data-loop="gl"] .site-search__reset:hover,
form.site-search[data-loop="gl"] .site-search__reset:focus {
  background-color: #fbecec;
  border-color: #d33;
}

/* =========================================================
   Mobile: stack field, full-width actions
   ========================================================= */
@media (max-width: 600px) {
  .site-searchwrap:has(form.site-search[data-loop="gl"]) {
    padding-inline: 0;
  }

  form.site-search[data-loop="gl"] .site-search__bar {
    padding: 1rem;
    border-radius: 22px;
  }

  form.site-search[data-loop="gl"] .site-search__row {
    display: grid;
    gap: 14px;
    grid-template-columns: 1fr;
  }

  form.site-search[data-loop="gl"] .site-search__field--input {
    width: 100%;
    min-width: 0;
  }

  form.site-search[data-loop="gl"] .site-search__actions {
    width: 100%;
    justify-content: center;
  }

  form.site-search[data-loop="gl"] input[type="search"] {
    height: 44px;
    min-height: 44px;
    font-size: 14px;
  }

  form.site-search[data-loop="gl"] .site-search__btn,
  form.site-search[data-loop="gl"] .site-search__reset {
    padding: 0 1.5em;
    min-height: 44px;
    line-height: 1.2;
  }
}
