/* Salvinta GRC – Knowledge Base Styles */

/* ── KB Layout ── */
.kb-layout {
  display: flex;
  min-height: calc(100vh - 68px);
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  gap: 2rem;
}

/* ── Sidebar ── */
.kb-sidebar {
  width: 260px;
  flex-shrink: 0;
}

.kb-sidebar-inner {
  position: sticky;
  top: 88px;
}

.kb-search {
  position: relative;
  margin-bottom: 1.5rem;
}

.kb-search input {
  width: 100%;
  padding: 0.6rem 0.9rem 0.6rem 2.4rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s;
  outline: none;
}
.kb-search input:focus { border-color: var(--primary); }
.kb-search .search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}

.kb-category {
  margin-bottom: 1.25rem;
}

.kb-category-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 0.5rem;
  margin-bottom: 0.4rem;
}

.kb-category ul {
  list-style: none;
}

.kb-category ul li a {
  display: block;
  padding: 0.45rem 0.75rem;
  border-radius: 7px;
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 450;
  transition: all 0.12s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kb-category ul li a:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.kb-category ul li a.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

/* ── Main Content ── */
.kb-content {
  flex: 1;
  min-width: 0;
}

/* ── Home View ── */
.kb-home-header {
  margin-bottom: 2.5rem;
}

.kb-home-header h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.kb-search-hero {
  position: relative;
  max-width: 520px;
  margin-top: 1.25rem;
}

.kb-search-hero input {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 3rem;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.kb-search-hero input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(105,108,255,0.12);
}
.kb-search-hero .search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.2rem;
  pointer-events: none;
}

.kb-categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.kb-category-card {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 1rem;
  cursor: default;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.kb-category-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.kb-category-card-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
}

.kb-category-card h3 {
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.kb-category-card-articles {
  list-style: none;
  margin-top: 0.6rem;
}

.kb-category-card-articles li a {
  font-size: 0.825rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0;
  transition: color 0.12s;
}

.kb-category-card-articles li a:hover { color: var(--primary); }

.kb-category-card-articles li a i { font-size: 0.9rem; flex-shrink: 0; }

/* ── Article View ── */
.kb-article-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.kb-breadcrumb {
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.kb-breadcrumb a { color: var(--primary); }
.kb-breadcrumb a:hover { color: var(--primary-dark); }

.kb-article-header h1 {
  font-size: 1.85rem;
  margin-bottom: 0.5rem;
}

.kb-article-meta {
  font-size: 0.825rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* ── Article Body (Markdown Rendered) ── */
.kb-article-body {
  max-width: 740px;
  line-height: 1.75;
  color: var(--text);
}

.kb-article-body h1,
.kb-article-body h2,
.kb-article-body h3,
.kb-article-body h4 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.kb-article-body h2 {
  font-size: 1.35rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.kb-article-body h3 { font-size: 1.1rem; }

.kb-article-body p {
  margin-bottom: 1rem;
  color: var(--text);
}

.kb-article-body ul,
.kb-article-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.kb-article-body li { margin-bottom: 0.3rem; color: var(--text); }

.kb-article-body a { color: var(--primary); }
.kb-article-body a:hover { color: var(--primary-dark); }

.kb-article-body code {
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.875em;
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.kb-article-body pre {
  background: #1e2436;
  color: #cdd6f4;
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
}

.kb-article-body pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: 0.875rem;
}

.kb-article-body blockquote {
  border-left: 4px solid var(--primary);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  background: var(--primary-light);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.kb-article-body blockquote p { margin: 0; color: var(--primary-dark); }

.kb-article-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

.kb-article-body th,
.kb-article-body td {
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  text-align: left;
}

.kb-article-body th {
  background: var(--light);
  font-weight: 600;
  color: var(--text);
}

.kb-article-body img { max-width: 100%; border-radius: var(--radius); }

.kb-article-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* ── States ── */
.kb-empty {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.kb-empty i { font-size: 3rem; opacity: 0.4; display: block; margin-bottom: 1rem; }
.kb-empty h3 { color: var(--text); margin-bottom: 0.5rem; }

.kb-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.kb-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: kb-spin 0.7s linear infinite;
}

@keyframes kb-spin { to { transform: rotate(360deg); } }

/* ── Page Hero ── */
.kb-hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 3rem 2rem 2.5rem;
  text-align: center;
}

.kb-hero h1 { color: #fff; font-size: 2.25rem; margin-bottom: 0.5rem; }
.kb-hero p { color: rgba(255,255,255,0.85); font-size: 1.05rem; margin: 0 auto; max-width: 520px; }

/* ── Search Results ── */
.kb-results {
  list-style: none;
  margin-top: 1rem;
}

.kb-result-item {
  padding: 1rem 1.25rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.kb-result-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.kb-result-item h4 {
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
  color: var(--primary);
}

.kb-result-item .kb-result-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Mobile ── */
.kb-mobile-menu-btn {
  display: none;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: 1.5px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  color: var(--text);
  margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
  .kb-layout { flex-direction: column; gap: 0; }
  .kb-sidebar { width: 100%; }
  .kb-sidebar-inner { position: static; }
  .kb-mobile-menu-btn { display: flex; }
  .kb-nav-collapsible { display: none; }
  .kb-nav-collapsible.open { display: block; }
}
