/* Knowledgebase live search (19 October 2026). Used by js/tg-kb-search.js on the knowledgebase pages
   (knowledgebase.tpl, knowledgebasecat.tpl, knowledgebasearticle.tpl) and the Open Ticket page
   (supportticketsubmit-steptwo.tpl). Colours: docs/design/client-area/README.md. Dark mode follows the
   theme switch (:root[data-bs-theme="dark"]). */

:root {
  --tgkb-surface: #ffffff;
  --tgkb-surface-2: #f8fafc;
  --tgkb-ink: #10243e;
  --tgkb-text: #1f2a37;
  --tgkb-muted: #5b6b7f;
  --tgkb-line: #e3e8ef;
  --tgkb-blue: #1f5fa8;
  --tgkb-blue-50: #e9f1fb;
  --tgkb-blue-100: #d6e5f7;
  --tgkb-mark: #fff2d9;
  --tgkb-mark-ink: #10243e;
  --tgkb-focus: #9cc3ff;
  --tgkb-shadow: 0 12px 32px rgba(16, 36, 62, .16), 0 2px 6px rgba(16, 36, 62, .08);
}
:root[data-bs-theme="dark"] {
  --tgkb-surface: #111c2e;
  --tgkb-surface-2: #16243a;
  --tgkb-ink: #f1f5f9;
  --tgkb-text: #dbe3ee;
  --tgkb-muted: #a3b1c4;
  --tgkb-line: #2a3a52;
  --tgkb-blue: #8cbcf5;
  --tgkb-blue-50: #1b3150;
  --tgkb-blue-100: #23406a;
  --tgkb-mark: #5c4210;
  --tgkb-mark-ink: #fff7e6;
  --tgkb-focus: #9cc3ff;
  --tgkb-shadow: 0 12px 32px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .35);
}

.tgkb-form { position: relative; }
.tgkb-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- results panel under the search box ---------- */
.tgkb-panel {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 1020;
  display: flex; flex-direction: column; max-height: 70vh; min-width: 0;
  background: var(--tgkb-surface); color: var(--tgkb-text);
  border: 1px solid var(--tgkb-line); border-radius: 12px; box-shadow: var(--tgkb-shadow);
  font-size: 14px; line-height: 1.45; text-align: left; overflow: hidden;
}
.tgkb-panel[hidden] { display: none; }
/* header search: the panel sits at the end of <body>, placed by the script above the header dropdown, the
   slide-in menu (z-index 9999) and the light and dark switch (z-index 99999) while it is open */
.tgkb-panel.tgkb-panel--header { position: fixed; z-index: 100001; }
.tgkb-head {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px; justify-content: space-between;
  padding: 9px 14px; border-bottom: 1px solid var(--tgkb-line); background: var(--tgkb-surface-2);
  color: var(--tgkb-muted); font-size: 12.5px; font-weight: 600; letter-spacing: .01em;
}
.tgkb-head .tgkb-keys { font-weight: 400; white-space: nowrap; }
.tgkb-list { flex: 1 1 auto; margin: 0; padding: 4px 0; list-style: none; overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.tgkb-list > li { margin: 0; padding: 0; }
.tgkb-item {
  display: block; padding: 10px 14px; color: inherit !important; text-decoration: none !important;
  border-left: 3px solid transparent; cursor: pointer; min-width: 0;
}
.tgkb-item:hover { background: var(--tgkb-surface-2); }
.tgkb-list > li.is-active > .tgkb-item,
.tgkb-list > li[aria-selected="true"] > .tgkb-item { background: var(--tgkb-blue-50); border-left-color: var(--tgkb-blue); }
.tgkb-t {
  display: block; color: var(--tgkb-ink); font-weight: 600; font-size: 14.5px; line-height: 1.35;
  overflow-wrap: anywhere;
}
.tgkb-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; min-width: 0; }
.tgkb-pill {
  display: inline-block; max-width: 100%; padding: 1px 9px; border-radius: 999px;
  background: var(--tgkb-blue-50); color: var(--tgkb-blue); border: 1px solid var(--tgkb-blue-100);
  font-size: 11.5px; font-weight: 600; line-height: 1.6;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tgkb-pill .tgkb-brand { font-weight: 500; opacity: .85; }
.tgkb-s {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-top: 4px; color: var(--tgkb-muted); font-size: 13px; overflow-wrap: anywhere;
}
.tgkb-panel mark, .tgkb-suggest mark {
  padding: 0 1px; border-radius: 2px; background: var(--tgkb-mark); color: var(--tgkb-mark-ink); font-weight: inherit;
}
.tgkb-foot { flex: 0 0 auto; border-top: 1px solid var(--tgkb-line); background: var(--tgkb-surface-2); }
.tgkb-foot > li { list-style: none; margin: 0; }
.tgkb-all {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px;
  padding: 10px 14px; color: var(--tgkb-blue) !important; font-weight: 600; text-decoration: none !important;
  border-left: 3px solid transparent;
}
.tgkb-all:hover { text-decoration: underline !important; }
.tgkb-foot > li.is-active > .tgkb-all { background: var(--tgkb-blue-50); border-left-color: var(--tgkb-blue); }
.tgkb-all .tgkb-arr { flex: 0 0 auto; }
.tgkb-msg { padding: 16px 14px; color: var(--tgkb-text); overflow-wrap: anywhere; }
.tgkb-msg strong { color: var(--tgkb-ink); }
.tgkb-msg p { margin: 0; }
.tgkb-msg p + p { margin-top: 6px; color: var(--tgkb-muted); }
.tgkb-msg a { color: var(--tgkb-blue) !important; font-weight: 600; text-decoration: underline; }
.tgkb-busy { padding: 12px 14px; color: var(--tgkb-muted); }
.tgkb-busy::before {
  content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px;
  border: 2px solid var(--tgkb-line); border-top-color: var(--tgkb-blue); border-radius: 50%;
  animation: tgkb-spin .8s linear infinite;
}
@keyframes tgkb-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .tgkb-busy::before { animation: none; } }

/* keyboard focus ring on links inside the panel (mouse users never see it) */
.tgkb-panel a:focus-visible, .tgkb-suggest a:focus-visible, .tgkb-suggest button:focus-visible {
  outline: 3px solid var(--tgkb-focus); outline-offset: 2px;
}

/* phones: the panel spans the screen (the script sets left and width), keys hint hidden */
@media (max-width: 575.98px) {
  .tgkb-panel { border-radius: 10px; }
  .tgkb-head .tgkb-keys { display: none; }
  .tgkb-item { padding: 12px 14px; }
}
@media (hover: none) {
  .tgkb-head .tgkb-keys { display: none; }
}

/* ---------- Open Ticket: suggestions under the Subject field ---------- */
.tgkb-suggest {
  margin-top: 8px; padding: 12px 14px; border: 1px solid var(--tgkb-blue-100); border-radius: 10px;
  background: var(--tgkb-surface); color: var(--tgkb-text); font-size: 14px; line-height: 1.45; min-width: 0;
}
.tgkb-suggest[hidden] { display: none; }
.tgkb-suggest-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.tgkb-suggest-head p { margin: 0; color: var(--tgkb-ink); font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.tgkb-suggest-head p span { display: block; margin-top: 2px; color: var(--tgkb-muted); font-weight: 400; font-size: 13px; }
.tgkb-hide {
  flex: 0 0 auto; min-height: 44px; min-width: 44px; margin: -12px -10px 0 0; padding: 0 10px;
  border: 0; background: transparent; color: var(--tgkb-blue); font-weight: 600; font-size: 13px; cursor: pointer;
}
.tgkb-suggest ul { margin: 8px 0 0; padding: 0; list-style: none; }
.tgkb-suggest li { margin: 0; border-top: 1px solid var(--tgkb-line); }
.tgkb-suggest li:first-child { border-top: 0; }
.tgkb-suggest li a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding: 8px 0;
  color: var(--tgkb-ink) !important; text-decoration: none !important; min-width: 0;
}
.tgkb-suggest li a:hover .tgkb-st { text-decoration: underline; }
.tgkb-suggest .tgkb-st { flex: 1 1 auto; font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.tgkb-suggest .tgkb-pill { flex: 0 0 auto; max-width: 45%; }
.tgkb-suggest .tgkb-ext { flex: 0 0 auto; color: var(--tgkb-muted); font-size: 12px; }
@media (max-width: 575.98px) {
  .tgkb-suggest li a { flex-wrap: wrap; gap: 4px 10px; }
  .tgkb-suggest .tgkb-pill { max-width: 100%; }
}

@media print { .tgkb-panel, .tgkb-suggest, .tgkb-gate { display: none !important; } }
