/* WAAS / DAAB global search — nav field + overlay (v3) */

/* ─── Top nav: modern search field (opens overlay) ─── */
.nav-search-btn {
  position: relative;
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  min-width: min(130px, 15vw);
  max-width: 150px;
  height: 40px;
  padding: 0 10px 0 12px;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  box-shadow:
    0 1px 2px rgba(0, 35, 70, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  white-space: nowrap;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.18s ease;
}

.nav-search-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.42);
  box-shadow:
    0 4px 14px rgba(0, 35, 70, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.nav-search-btn:active {
  transform: scale(0.985);
}

.nav-search-btn:focus-visible {
  outline: none;
  border-color: rgba(255, 240, 191, 0.95);
  box-shadow:
    0 0 0 3px rgba(255, 240, 191, 0.38),
    0 4px 16px rgba(0, 35, 70, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.nav-search-btn-icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}

.nav-search-btn-icon svg {
  display: block;
  opacity: 0.95;
}

.nav-search-btn-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.78);
}

.nav-search-kbd {
  flex-shrink: 0;
  margin-left: 2px;
  padding: 4px 7px;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.03em;
}

/* ─── Search overlay ─── */
#search-overlay {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

#search-overlay.open {
  opacity: 1;
  visibility: visible;
}

.search-modal {
  display: flex;
  flex-direction: column;
  max-height: min(72vh, 560px);
  transform: translateY(-12px) scale(0.985);
  opacity: 0;
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s ease;
}

#search-overlay.open .search-modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.search-input-row {
  gap: 14px;
  padding: 14px 18px !important;
  background: linear-gradient(180deg, #f8fcff 0%, #fff 100%);
}

.search-icon-large {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  color: var(--blue-700);
  background: linear-gradient(135deg, #e8f6fd 0%, #d4ecfa 100%);
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px rgba(0, 105, 180, 0.12);
}

.search-icon-large svg {
  display: block;
}

#search-input {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

#search-input::placeholder {
  color: #8aa0b7;
  font-weight: 400;
}

.search-close-btn {
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.search-result-item {
  animation: daabSearchFadeIn 0.18s ease both;
}

.search-result-item:nth-child(2) { animation-delay: 0.02s; }
.search-result-item:nth-child(3) { animation-delay: 0.04s; }
.search-result-item:nth-child(4) { animation-delay: 0.06s; }
.search-result-item:nth-child(5) { animation-delay: 0.08s; }

@keyframes daabSearchFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-hl {
  padding: 0 1px;
  color: inherit;
  background: rgba(0, 168, 232, 0.22);
  border-radius: 3px;
  font-weight: 800;
}

.search-close-btn:hover {
  color: var(--ink);
  background: #e3f3fb;
}

.search-empty,
.search-prompt {
  line-height: 1.55;
}

.search-hint {
  background: #f7fbfd;
}

/* Hide Ctrl/Cmd+K hint on touch devices and compact nav (desktop keeps hint) */
@media (max-width: 1180px), (hover: none), (pointer: coarse) {
  .nav-search-kbd,
  .gateway-search-kbd {
    display: none !important;
  }

  .nav-search-btn {
    padding-right: 12px;
    gap: 8px;
  }

  .gateway-search-btn .gateway-search-kbd {
    display: none !important;
  }

  .search-hint {
    display: none !important;
  }
}

/* Compact icon pill when nav hides label (matches daab-common @1320px) */
@media (max-width: 1320px) {
  .nav-search-btn-label,
  .nav-search-kbd {
    display: none !important;
  }

  .nav-search-btn {
    min-width: 44px !important;
    max-width: 44px !important;
    width: 44px !important;
    height: 40px;
    padding: 0 !important;
    justify-content: center;
    gap: 0;
  }

  .nav-search-btn-icon {
    width: 100%;
    height: 100%;
    background: transparent;
    border-radius: 0;
  }
}

@media (max-width: 760px) {
  #search-overlay {
    padding-top: max(72px, 12vh) !important;
    padding-left: max(10px, env(safe-area-inset-left)) !important;
    padding-right: max(10px, env(safe-area-inset-right)) !important;
  }

  .search-modal {
    width: min(720px, 96vw) !important;
    max-height: calc(100dvh - 96px);
    border-radius: 20px !important;
  }

  #search-input {
    font-size: 16px;
  }

  .search-hint {
    display: none !important;
  }

  .sri-desc {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  #search-overlay,
  .search-modal,
  .search-result-item,
  .nav-search-btn {
    transition: none !important;
    animation: none !important;
  }

  .nav-search-btn:active {
    transform: none;
  }
}

/* Gateway page search button */
.gateway-search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: 0 1px 2px rgba(13, 31, 60, 0.06);
}

.gateway-search-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: rgba(0, 105, 180, 0.08);
  border-radius: 50%;
}

.gateway-search-kbd {
  display: inline-block;
  margin-left: 2px;
  padding: 4px 7px;
  color: #4a6278;
  background: #f0f6fb;
  border: 1px solid #d0dde8;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.3;
}
