/*!
 * Copyright (c) 2025 Kenneth Raymond
 * All rights reserved.
 *
 * Part of the Experts in CMT WordPress theme.
 * Do not copy, modify, or redistribute without permission.
 *
 * ------------------------------------------------------------
 * GENES DB — FILTER UI
 * ------------------------------------------------------------
 * Styles for:
 *   • Genes Database filter bar (2×2 selects + search)
 *   • Sort toolbar (dropdown + clear)
 *   • Responsive grid layout
 *
 * Scope:
 *   .genesdb-filter-wrap
 *
 * Notes:
 *   - Shares visual parity with Glossary + Dorsal Root filters
 *   - Designed for the Genes AJAX stack (v0.8+)
 */

/* =========================================================
   Genes DB — FILTER UI (2×2 selects + search below)
   Scope: .genesdb-filter-wrap only
   ========================================================= */

.genesdb-filter-wrap {
  max-width: 980px;
  margin-inline: auto;
  padding-inline: 12px;
}
.genesdb-filter-wrap .genes-filter {
  margin: 0 0 28px;
}
.genesdb-filter-wrap .genes-filter__bar {
  max-width: 860px;
  margin-inline: auto;
}

/* Base grid: mobile stacks everything */
.genesdb-filter-wrap .genes-filter__row {
  display: grid;
  gap: 16px; /* tightened slightly */
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: end;
}
.genesdb-filter-wrap .genes-filter__field,
.genesdb-filter-wrap .genes-filter__field--search,
.genesdb-filter-wrap .genes-filter__hr {
  grid-column: 1 / -1;
}

/* =========================================================
   Desktop layout: 2 × 2 for the selects, search full width under them
   ========================================================= */
@media (min-width: 768px) {
  .genesdb-filter-wrap .genes-filter__hr {
    display: none;
  }

  .genesdb-filter-wrap .genes-filter__field:nth-of-type(1) {
    grid-column: 1 / span 6;
  }
  .genesdb-filter-wrap .genes-filter__field:nth-of-type(2) {
    grid-column: 7 / span 6;
  }
  .genesdb-filter-wrap .genes-filter__field:nth-of-type(3) {
    grid-column: 1 / span 6;
  }
  .genesdb-filter-wrap .genes-filter__field:nth-of-type(4) {
    grid-column: 7 / span 6;
  }
  .genesdb-filter-wrap .genes-filter__field--search {
    grid-column: 1 / -1;
  }
}

/* Labels */
.genesdb-filter-wrap .genes-filter__label {
  display: block;
  font-weight: 500;
  font-size: 0.9rem; /* reduced by 1px */
  color: #1f2937;
  margin: 0 0 4px 2px; /* adjusted to align visually with input text */
  text-align: left; /* ensures left alignment */
}

/* Inputs */
.genesdb-filter-wrap .genes-filter select,
.genesdb-filter-wrap .genes-filter input[type="search"] {
  width: 100%;
  height: 44px;
  padding: 10px 14px;
  border: 1px solid #d6d9de;
  border-radius: 12px; /* slightly more rounded to match buttons */
  background: #fff;
  font-size: 15px; /* reduced by 1px */
  line-height: 1.2;
  outline: none;
  transition: box-shadow 0.12s ease, border-color 0.12s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238E97A3' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 8px;
}
.genesdb-filter-wrap .genes-filter input[type="search"] {
  background-image: none;
}
.genesdb-filter-wrap .genes-filter select:focus,
.genesdb-filter-wrap .genes-filter input[type="search"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

/* Actions row */
.genesdb-filter-wrap .genes-filter__actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
}

/* Apply Button — match universal button system */
.genesdb-filter-wrap .genes-filter__btn {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
  border-radius: 16px;
  padding: 0.75em 2.5em;
  line-height: 1.5;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  transition: background-color 0.15s ease, color 0.15s ease,
    border-color 0.15s ease, box-shadow 0.25s ease;
}
.genesdb-filter-wrap .genes-filter__btn:hover,
.genesdb-filter-wrap .genes-filter__btn:focus {
  background-color: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Reset Button — match global button sizing + style */
.genesdb-filter-wrap .genes-filter__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;

  padding: 0.75em 2.5em; /* same as main.css buttons */
  line-height: 1.5;
  min-block-size: 48px; /* ensures identical height */
  border-radius: 16px; /* match global radius */

  border: 1.5px solid #f1bbbb;
  background: #fff5f5;
  color: #8b1b1b;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease,
    border-color 0.15s ease;
}
.genesdb-filter-wrap .genes-filter__link:hover,
.genesdb-filter-wrap .genes-filter__link:focus {
  background-color: #fbecec;
  border-color: #d33;
}

/* Anchor offset */
#genes-filter {
  scroll-margin-top: 90px;
}

/* =========================================================
   Genes DB — SORT UI (dropdown + clear)
   Sits between the search field and the actions row
   Scope: .genesdb-filter-wrap only
   ========================================================= */

.genesdb-filter-wrap .genes-sort {
  grid-column: 1 / -1; /* own row in the grid */
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end; /* right align (like your Wix shot) */
  margin-top: 2px;
}

.genesdb-filter-wrap .genes-sort__label {
  font-weight: 500;
  font-size: 0.9rem;
  color: #1f2937;
  margin: 0 2px 0 0;
}

.genesdb-filter-wrap .genes-sort__select {
  height: 44px;
  padding: 10px 38px 10px 14px; /* room for caret */
  border: 1px solid #d6d9de;
  border-radius: 12px;
  background: #fff;
  font-size: 15px;
  line-height: 1.2;
  outline: none;
  transition: box-shadow 0.12s ease, border-color 0.12s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238E97A3' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 8px;
}
.genesdb-filter-wrap .genes-sort__select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

/* Clear pill — matches your RESET sizing/voice, but smaller and round */
.genesdb-filter-wrap .genes-sort__clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;

  padding: 0.45em 1.1em;
  min-block-size: 38px;
  border-radius: 999px;

  border: 1.5px solid #f1bbbb;
  background: #fff5f5;
  color: #8b1b1b;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease,
    border-color 0.15s ease;
}
.genesdb-filter-wrap .genes-sort__clear:hover,
.genesdb-filter-wrap .genes-sort__clear:focus {
  background-color: #fbecec;
  border-color: #d33;
}

/* Responsive tweaks */
@media (max-width: 767.98px) {
  .genesdb-filter-wrap .genes-sort {
    justify-content: center; /* center on small screens */
    gap: 8px;
  }
  .genesdb-filter-wrap .genes-sort__label {
    font-size: 0.85rem;
  }
  .genesdb-filter-wrap .genes-sort__select {
    height: 42px;
    font-size: 14px;
  }
  .genesdb-filter-wrap .genes-sort__clear {
    min-block-size: 36px;
    font-size: 13px;
  }
}

/* === MOBILE BUTTON HEIGHT FIX: MATCH SELECT HEIGHT (44px) === */
@media (max-width: 600px) {

  /* Browse button */
  .genesdb-filter-wrap .genes-filter__btn {
    padding: 0 1.5em !important;
    min-height: 44px !important;
    line-height: 1.2 !important;
  }

  /* Reset button */
  .genesdb-filter-wrap .genes-filter__link {
    padding: 0 1.5em !important;
    min-height: 44px !important;
    line-height: 1.2 !important;
  }
}

