/* ============================================================
   CBP DESK — Knowledge Base panel
   Standalone stylesheet. Loaded by index.html alongside cbp.css.
   Retinted from the original cyan (#00bcd4) to CBP teal.
   ============================================================ */

/* ── Overlay shell ─────────────────────────────────────────── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 100;
  align-items: flex-start;
  justify-content: center;
  padding-top: 52px;
}
.overlay.open { display: flex; }

.kb-panel {
  background: var(--bg, #f2f4f7);
  width: 100%;
  max-width: 900px;
  height: calc(100vh - 52px);
  border-radius: 12px 12px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, .2);
}

/* ── Header ────────────────────────────────────────────────── */
.kb-header {
  background: #1a1d21;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.kb-header h2 {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}
.kb-header h2 svg {
  stroke: var(--teal, #1D8FA9);
  width: 20px;
  height: 20px;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.kb-close {
  background: none;
  border: none;
  color: #aaa;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 4px;
}
.kb-close:hover { color: #fff; background: rgba(255, 255, 255, .1); }

/* ── Toolbar ───────────────────────────────────────────────── */
.kb-toolbar {
  padding: 16px 24px 12px;
  background: #fff;
  border-bottom: 1px solid var(--border, #dde1e7);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.kb-search {
  flex: 1;
  min-width: 220px;
  padding: 9px 14px 9px 38px;
  border: 1px solid var(--border, #dde1e7);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text, #1a1d21);
  background: #f8f9fa url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") 11px center no-repeat;
  outline: none;
}
.kb-search:focus {
  border-color: var(--teal, #1D8FA9);
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(29, 143, 169, .15);
}

.filter-btn {
  padding: 7px 14px;
  border: 1px solid var(--border, #dde1e7);
  border-radius: 20px;
  background: #fff;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  color: #555;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.filter-btn:hover,
.filter-btn.active {
  background: var(--teal, #1D8FA9);
  border-color: var(--teal, #1D8FA9);
  color: #fff;
}

.kb-count {
  font-size: 12px;
  color: var(--text-muted, #6b7280);
  margin-left: auto;
  white-space: nowrap;
}

/* ── Body / Q&A cards ──────────────────────────────────────── */
.kb-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 32px;
}

.qa-card {
  background: #fff;
  border-radius: 8px;
  margin-bottom: 10px;
  border: 1px solid var(--border, #dde1e7);
  overflow: hidden;
}
.qa-question {
  padding: 14px 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.qa-question:hover { background: var(--teal-light, #e4f4f8); }

.qa-q-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text, #1a1d21);
  flex: 1;
}
.qa-tag {
  font-size: 10px;
  background: var(--teal-light, #e4f4f8);
  color: var(--teal-dark, #166f84);
  padding: 3px 8px;
  border-radius: 10px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.qa-chevron {
  color: #bbb;
  font-size: 14px;
  flex-shrink: 0;
  transition: transform .2s;
}
.qa-card.open .qa-chevron { transform: rotate(180deg); }

.qa-answer {
  display: none;
  padding: 14px 18px 16px;
  font-size: 13.5px;
  color: #444;
  line-height: 1.65;
  border-top: 1px solid #f0f0f0;
  white-space: pre-wrap;
}
.qa-card.open .qa-answer { display: block; }

/* ── Empty / loading / error states ────────────────────────── */
.kb-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted, #6b7280);
}
.kb-state svg {
  width: 48px;
  height: 48px;
  stroke: #ccc;
  fill: none;
  margin: 0 auto 12px;
  display: block;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.kb-state p { font-size: 14px; margin: 0; }
.kb-state .kb-state-sub {
  font-size: 12px;
  margin-top: 6px;
  color: #aaa;
}

/* ── Mobile ────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .overlay { padding-top: 0; }
  .kb-panel { height: 100vh; border-radius: 0; }
  .kb-toolbar { padding: 12px 16px 10px; }
  .kb-body { padding: 12px 16px 32px; }
  .kb-header { padding: 14px 16px; }
  .kb-count { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .qa-chevron, .filter-btn { transition: none; }
}

/* ── Offline banner ────────────────────────────────────────── */
.kb-offline {
  background: #fdf3e6;
  border: 1px solid #e8c79a;
  color: #78500f;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.55;
}
.kb-offline strong { color: #6b4409; }
.kb-offline-detail {
  display: block;
  margin-top: 4px;
  font-size: 11.5px;
  color: #9a7434;
  font-family: ui-monospace, Consolas, monospace;
  word-break: break-word;
}

/* ── Search match highlight ────────────────────────────────── */
.qa-answer mark,
.qa-q-text mark {
  background: #ffe9a8;
  color: inherit;
  padding: 0 1px;
  border-radius: 2px;
}
