/* ============================================================
   QueryFlow Knowledge Hub — page-specific styles
   Extends shared.css with the knowledge layout
   ============================================================ */

/* ============================================================
   HERO + SEARCH
   ============================================================ */
.kb-hero {
  padding: 160px 32px 60px;
  text-align: center;
  max-width: 1100px;
  margin: 0 auto;
}

.kb-search-wrap {
  position: relative;
  max-width: 640px;
  margin: 40px auto 0;
}

.kb-search-icon {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}

#kb-search {
  width: 100%;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 18px 60px 18px 56px;
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--text-primary);
  outline: none;
  backdrop-filter: blur(24px);
  transition: all 200ms cubic-bezier(0.32, 0.72, 0, 1);
}

#kb-search::placeholder { color: var(--text-tertiary); }

#kb-search:focus {
  border-color: rgba(0, 229, 255, 0.4);
  background: var(--surface-2);
  box-shadow: 0 0 0 4px rgba(0, 229, 255, 0.08);
}

.kb-search-hint {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--hairline);
  padding: 3px 8px;
  border-radius: 6px;
}

/* ============================================================
   YOUTUBE FEATURED SECTION
   ============================================================ */
.kb-video {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px 60px;
}

.kb-video-inner {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: 24px;
  padding: 40px;
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 48px;
  align-items: center;
  backdrop-filter: blur(24px);
  position: relative;
  overflow: hidden;
}

.kb-video-inner::before {
  content: '';
  position: absolute;
  top: -100px;
  right: -100px;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(255, 0, 80, 0.12) 0%, transparent 60%);
  pointer-events: none;
  filter: blur(40px);
}

.kb-video-text {
  position: relative;
  z-index: 1;
}

.kb-video-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: #FF4060;
  text-transform: uppercase;
  margin-bottom: 16px;
  display: inline-block;
}

.kb-video-text h2 {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 14px;
}

.kb-video-text p {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 24px;
}

.btn-youtube {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #FF0033;
  color: white;
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: all 200ms cubic-bezier(0.32, 0.72, 0, 1);
}

.btn-youtube:hover {
  background: #E60030;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 0, 51, 0.3);
}

.kb-video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--hairline);
}

.kb-video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* ============================================================
   LAYOUT: STICKY SIDEBAR + CONTENT
   ============================================================ */
.kb-layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 32px 60px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 56px;
  align-items: flex-start;
}

.kb-sidebar {
  position: sticky;
  top: 92px;
  height: calc(100vh - 120px);
  min-height: 500px;
  overflow-y: auto;
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  padding: 24px 20px;
  backdrop-filter: blur(24px);
}

/* Custom scrollbar in the sidebar */
.kb-sidebar::-webkit-scrollbar { width: 6px; }
.kb-sidebar::-webkit-scrollbar-track { background: transparent; }
.kb-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}

.kb-sidebar-toggle {
  display: none;
  width: 100%;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  padding: 8px 12px;
  cursor: pointer;
  align-items: center;
  justify-content: space-between;
}

.kb-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sb-cat { margin-bottom: 20px; }
.sb-cat:last-child { margin-bottom: 0; }

.sb-cat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--accent-cyan);
  text-transform: uppercase;
  margin-bottom: 10px;
  padding: 0 12px;
}

.sb-link {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 8px;
  transition: all 150ms cubic-bezier(0.32, 0.72, 0, 1);
  border-left: 2px solid transparent;
  line-height: 1.4;
}

.sb-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.sb-link.active {
  background: rgba(0, 229, 255, 0.08);
  color: var(--text-primary);
  border-left-color: var(--accent-cyan);
}

/* Sidebar hides items hidden by search */
.sb-link.hidden { display: none; }
.sb-cat.hidden { display: none; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.kb-content {
  min-width: 0;
}

.kb-section {
  background: var(--surface-1);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  padding: 36px 40px;
  margin-bottom: 24px;
  backdrop-filter: blur(24px);
  scroll-margin-top: 100px;
}

.kb-section.hidden { display: none; }

.kb-section h2 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 18px;
  color: var(--text-primary);
}

.kb-section h3 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 32px 0 14px;
  color: var(--text-primary);
}

.kb-section h2:first-child,
.kb-section h3:first-child {
  margin-top: 0;
}

.kb-section p {
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.kb-section p strong,
.kb-section ul strong,
.kb-section ol strong {
  color: var(--text-primary);
  font-weight: 600;
}

.kb-section ul,
.kb-section ol {
  margin: 14px 0 18px 0;
  padding-left: 24px;
}

.kb-section li {
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.kb-section li::marker { color: var(--accent-cyan); font-weight: 600; }

/* Numbered steps — special styling */
.kb-section ol.steps {
  counter-reset: step;
  padding-left: 0;
  list-style: none;
}

.kb-section ol.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 44px;
  margin-bottom: 12px;
  min-height: 32px;
}

.kb-section ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 28px;
  height: 28px;
  background: rgba(0, 229, 255, 0.1);
  border: 1px solid rgba(0, 229, 255, 0.3);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 100px;
  flex-shrink: 0;
}

/* Inline code */
.kb-section code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent-cyan);
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--hairline);
}

/* Keyboard keys */
.kb-section kbd {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--hairline-bold);
  border-bottom-width: 2px;
  display: inline-block;
  line-height: 1;
}

/* Code block with copy button */
.code-block {
  position: relative;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  margin: 14px 0;
  overflow: hidden;
}

.code-block pre {
  padding: 18px 22px;
  padding-right: 80px;
  overflow-x: auto;
  margin: 0;
}

.code-block code {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
  background: none;
  border: none;
  padding: 0;
  white-space: pre;
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--hairline);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 5px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 200ms cubic-bezier(0.32, 0.72, 0, 1);
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: var(--hairline-bold);
}

.copy-btn.copied {
  background: rgba(57, 255, 136, 0.1);
  border-color: rgba(57, 255, 136, 0.3);
  color: var(--accent-green);
}

/* Shortcut table */
.shortcut-table {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  overflow: hidden;
  margin: 16px 0;
}

.shortcut-table table {
  width: 100%;
  border-collapse: collapse;
}

.shortcut-table th,
.shortcut-table td {
  padding: 12px 18px;
  text-align: left;
  border-bottom: 1px solid var(--hairline);
  font-size: 14px;
}

.shortcut-table th {
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.shortcut-table td:first-child {
  width: 200px;
}

.shortcut-table tr:last-child td { border-bottom: none; }

/* ============================================================
   CALLOUT BOXES
   ============================================================ */
.callout {
  padding: 16px 20px;
  border-radius: 12px;
  margin: 18px 0;
  border-left: 3px solid;
  background: rgba(255, 255, 255, 0.03);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.callout strong { color: var(--text-primary); }

.callout-tip {
  border-left-color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.06);
}
.callout-tip strong { color: var(--accent-cyan); }

.callout-heads-up {
  border-left-color: #FFB84D;
  background: rgba(255, 184, 77, 0.06);
}
.callout-heads-up strong { color: #FFB84D; }

.callout-important {
  border-left-color: #FF5C5C;
  background: rgba(255, 92, 92, 0.06);
}
.callout-important strong { color: #FF5C5C; }

/* ============================================================
   HELPFUL FEEDBACK
   ============================================================ */
.helpful {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-tertiary);
}

.helpful-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--hairline);
  color: var(--text-secondary);
  font-size: 15px;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 200ms;
}

.helpful-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--hairline-bold);
}

.helpful-btn.voted {
  background: rgba(0, 229, 255, 0.1);
  border-color: rgba(0, 229, 255, 0.3);
  color: var(--accent-cyan);
}

/* ============================================================
   NO RESULTS
   ============================================================ */
.kb-no-results {
  text-align: center;
  padding: 80px 32px;
  display: none;
}

.kb-no-results.show { display: block; }

.kb-no-results h3 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.kb-no-results p {
  color: var(--text-secondary);
  font-size: 15px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 960px) {
  .kb-video-inner {
    grid-template-columns: 1fr;
    padding: 28px;
    gap: 28px;
  }

  .kb-video-text h2 {
    font-size: 32px;
  }

  .kb-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  /* Mobile: sidebar becomes a clean accordion at the top */
  .kb-sidebar {
    position: static;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: hidden;
    padding: 0;
  }

  /* Toggle becomes a real-looking button bar */
  .kb-sidebar-toggle {
    display: flex !important;
    width: 100%;
    padding: 16px 20px;
    background: var(--surface-1);
    border: 1px solid var(--hairline);
    border-radius: 16px;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
  }

  .kb-sidebar-toggle svg {
    color: var(--accent-cyan);
    transition: transform 300ms ease;
  }

  .kb-sidebar.open .kb-sidebar-toggle svg {
    transform: rotate(180deg);
  }

  /* Collapsed by default on mobile */
  .kb-sidebar-nav {
    max-height: 0;
    overflow: hidden;
    transition: max-height 400ms cubic-bezier(0.32, 0.72, 0, 1);
  }

  .kb-sidebar.open {
    background: var(--surface-1);
    border: 1px solid var(--hairline);
    border-radius: 16px;
    padding: 8px;
  }

  .kb-sidebar.open .kb-sidebar-toggle {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--hairline);
    border-radius: 0;
  }

  .kb-sidebar.open .kb-sidebar-nav {
    max-height: 70vh;
    overflow-y: auto;
    margin-top: 8px;
    padding: 12px;
  }
}

@media (max-width: 700px) {
  .kb-hero { padding: 120px 20px 40px; }
  .kb-video { padding: 0 20px 40px; }
  .kb-video-inner { padding: 24px; }
  .kb-layout { padding: 20px 20px 40px; }
  .kb-section { padding: 24px 22px; }
  .kb-section h2 { font-size: 24px; }
  .kb-section h3 { font-size: 17px; }
  .kb-section ol.steps > li { padding-left: 38px; }
  .kb-section ol.steps > li::before { width: 24px; height: 24px; font-size: 11px; }
  .code-block pre { padding: 14px 18px; padding-right: 70px; }
  .code-block code { font-size: 12px; }
  .shortcut-table th, .shortcut-table td { padding: 10px 14px; font-size: 13px; }
  .shortcut-table td:first-child { width: auto; }
}
