/* Unified ticket + KB search (helpdesk bar + optional topbar) */
.hd-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hd-search-wrap {
  position: relative;
  flex: 1 1 180px;
  min-width: min(200px, 42vw);
  max-width: 420px;
}

/* Main search: sits just after Submit ticket (nav gap) + modest inset — not centred in the whole bar */
.helpdesk-bar .hd-nav .hd-nav-search {
  flex: 1 1 280px;
  min-width: 0;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  min-height: 0;
  padding-left: 14px;
  box-sizing: border-box;
}
.helpdesk-bar .hd-nav .hd-nav-search .hd-search-wrap.hd-search-main {
  flex: 1 1 auto;
  width: 100%;
  max-width: min(720px, 100%);
  min-width: 0;
}
@media (max-width: 700px) {
  .helpdesk-bar .hd-nav .hd-nav-search {
    flex: 1 1 100%;
    min-width: 0;
  }
}

.hd-global-search-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 10px 14px 10px 40px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  border: 2px solid transparent;
}

body.dark .hd-global-search-input {
  background: #0d1117;
  border-color: #388bfd;
  color: #e6edf3;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
body.dark .hd-global-search-input::placeholder {
  color: #7d8590;
  font-weight: 500;
}
body.light .hd-global-search-input {
  background: #fff;
  border-color: #0969da;
  color: #24292f;
  box-shadow: 0 1px 3px rgba(1, 4, 9, 0.1);
}
body.light .hd-global-search-input::placeholder {
  color: #424a53;
  font-weight: 500;
}

.hd-global-search-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.45), 0 1px 2px rgba(0, 0, 0, 0.2);
}
body.light .hd-global-search-input:focus {
  box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.35), 0 1px 3px rgba(1, 4, 9, 0.12);
}

.hd-search-wrap::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  opacity: 0.85;
  background: no-repeat center / contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2358a6ff' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='10' cy='10' r='6'/%3E%3Cpath d='M15 15l6 6'/%3E%3C/svg%3E");
  pointer-events: none;
}
body.light .hd-search-wrap::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230969da' stroke-width='2.5' stroke-linecap='round'%3E%3Ccircle cx='10' cy='10' r='6'/%3E%3Cpath d='M15 15l6 6'/%3E%3C/svg%3E");
}

.hd-global-search-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  min-width: min(100%, 320px);
  max-height: min(70vh, 480px);
  overflow-y: auto;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  z-index: 10050;
  font-size: 13px;
}

body.dark .hd-global-search-panel {
  background: #161b22;
  border: 1px solid #30363d;
}
body.light .hd-global-search-panel {
  background: #fff;
  border: 1px solid #d0d7de;
}

.hd-global-search-panel[hidden] {
  display: none !important;
}

.hd-search-hint {
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.45;
}
body.dark .hd-search-hint {
  color: #8b949e;
}
body.light .hd-search-hint {
  color: #57606a;
}

.hd-search-group-label {
  padding: 8px 14px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
body.dark .hd-search-group-label {
  color: #8b949e;
}
body.light .hd-search-group-label {
  color: #57606a;
}

.hd-search-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 10px;
}

.hd-search-chip {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
}
body.dark .hd-search-chip {
  background: #21262d;
  color: #c9d1d9;
  border: 1px solid #30363d;
}
body.light .hd-search-chip {
  background: #f6f8fa;
  color: #424a53;
  border: 1px solid #d0d7de;
}

.hd-search-item {
  display: block;
  padding: 10px 14px;
  text-decoration: none;
  border-top: 1px solid;
  cursor: pointer;
  border-left: none;
  border-right: none;
  border-bottom: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 13px;
  background: transparent;
  box-sizing: border-box;
}
body.dark .hd-search-item {
  border-color: #21262d;
  color: #e6edf3;
}
body.light .hd-search-item {
  border-color: #eaeef2;
  color: #24292f;
}
body.dark .hd-search-item:hover,
body.dark .hd-search-item.hd-search-item-active {
  background: #21262d;
}
body.light .hd-search-item:hover,
body.light .hd-search-item.hd-search-item-active {
  background: #f6f8fa;
}

.hd-search-item-title {
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.hd-search-item-meta {
  font-size: 11px;
  opacity: 0.88;
  margin-bottom: 4px;
}

.hd-search-item-snippet {
  font-size: 12px;
  line-height: 1.4;
  opacity: 0.92;
}

.hd-search-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
}
body.dark .hd-search-badge {
  background: #388bfd22;
  color: #58a6ff;
}
body.light .hd-search-badge {
  background: #ddf4ff;
  color: #0969da;
}

/* Submit page topbar: search follows links, modest inset (matches helpdesk bar) */
.topbar-links {
  flex: 1;
  min-width: 0;
}
.topbar-links-start {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.topbar-links-search {
  flex: 1 1 280px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  min-width: min(200px, 50vw);
  padding-left: 14px;
  box-sizing: border-box;
}
.topbar-links-search .hd-search-wrap.hd-search-main {
  flex: 0 1 auto;
  width: min(640px, 100%);
  max-width: 100%;
}
@media (max-width: 700px) {
  .topbar-links-search {
    flex: 1 1 100%;
    min-width: 0;
  }
}

/* Topbar compact search (non-main embeds only) */
.topbar .hd-search-wrap:not(.hd-search-main) {
  max-width: 360px;
  min-width: min(160px, 36vw);
}

.hd-global-search-panel .link {
  color: #58a6ff;
  text-decoration: underline;
}
body.light .hd-global-search-panel .link {
  color: #0969da;
}
