/*
 * GP Search — reusable live-search component.
 */

.gp-search-wrap {
  position: relative;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gp-search-wrap--icon {
  width: 42px;
  max-width: none;
  min-width: 42px;
  flex: 0 0 42px;
  align-items: center;
  gap: 0;
  overflow: visible;
  z-index: 1000;
}

.gp-search-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #374151;
  cursor: pointer;
  transition: color 0.2s ease;
}

.gp-search-toggle:hover,
.gp-search-toggle:focus-visible {
  border-color: #e5e7eb;
  background: #f3f4f6;
  color: #374151;
  outline: none;
}

.gp-search-toggle__icon {
  display: inline-flex;
  line-height: 1;
}

.gp-search-input {
  width: auto;
  flex: 1 1 260px;
  padding: 10px 16px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 1rem;
  background: #fff;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
}

.gp-search-wrap--icon .gp-search-input {
  position: absolute;
  top: 50%;
  right: calc(100% + 8px);
  transform: translateY(-50%);
  flex: none;
  width: 0;
  min-width: 0;
  padding-top: 10px;
  padding-bottom: 10px;
  padding-left: 0;
  padding-right: 0;
  border-width: 1px;
  border-color: transparent;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 1001;
  transition: width 0.2s ease, min-width 0.2s ease, padding 0.2s ease, opacity 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.gp-search-wrap--icon.gp-search-wrap--open .gp-search-input {
  opacity: 1;
  pointer-events: auto;
}

.gp-search-wrap--icon.gp-search-wrap--open .gp-search-input {
  width: min(320px, 70vw);
  min-width: 220px;
  padding-left: 14px;
  padding-right: 14px;
  background: #fff;
  border-color: #d1d5db;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
}

.gp-search-submit {
  flex: 0 0 auto;
  padding: 10px 16px;
  border: 1px solid #1d4ed8;
  border-radius: 6px;
  background: #1d4ed8;
  color: #fff;
  font-size: 0.9375rem;
  line-height: 1.2;
  cursor: pointer;
}

.gp-search-submit:hover,
.gp-search-submit:focus {
  background: #1e40af;
  border-color: #1e40af;
}

.gp-search-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* ── Results dropdown ──────────────────────────────────────────────────────── */

.gp-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  width: 100%;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,.10);
  z-index: 9999;
  overflow: hidden;
  max-height: 340px;
  overflow-y: auto;
}

.gp-search-wrap--icon .gp-search-results {
  top: calc(50% + 28px);
  left: auto;
  right: calc(100% + 8px);
  width: min(320px, 70vw);
  z-index: 1002;
}

.gp-search-results[hidden] {
  display: none;
}

.gp-search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
}

.gp-search-result:last-child {
  border-bottom: none;
}

.gp-search-result:hover,
.gp-search-result:focus,
.gp-search-result[aria-selected="true"] {
  background: #f5f5ff;
  outline: none;
}

.gp-search-result__title {
  flex: 1;
  font-size: 0.9375rem;
  font-weight: 500;
}

.gp-search-result__type {
  font-size: 0.75rem;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}

.gp-search-status {
  padding: 12px 14px;
  font-size: 0.875rem;
  color: #6b7280;
  text-align: center;
}

@media (max-width: 767px) {
  .gp-search-wrap--icon.gp-search-wrap--open .gp-search-input {
    width: min(220px, 58vw);
    min-width: 160px;
  }

  .gp-search-wrap--icon .gp-search-results {
    width: min(220px, 58vw);
  }
}
