/* ========================================
   Knowledge Base Styles
   ======================================== */

/* Search Widget */
.kb-search-widget {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  margin-bottom: 2rem;
}

.kb-search-header h2 {
  font-size: 1.75rem;
  margin: 0 0 0.5rem 0;
  color: #1a1a1a;
}

.kb-search-subtitle {
  color: #666;
  margin: 0 0 1.5rem 0;
  font-size: 1rem;
}

/* Search Box */
.kb-search-box {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  border-radius: 10px;
  padding: 0.25rem;
  transition: border-color 0.2s;
}

.kb-search-box:focus-within {
  border-color: #4f46e5;
}

.kb-search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  outline: none;
  color: #1a1a1a;
}

.kb-search-input::placeholder {
  color: #9ca3af;
}

.kb-search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: #4f46e5;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.kb-search-btn:hover {
  background: #4338ca;
}

/* Categories */
.kb-search-categories {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.kb-category-label {
  font-size: 0.875rem;
  color: #6b7280;
  font-weight: 500;
}

.kb-category-pills {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex: 1;
}

.kb-category-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.875rem;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  font-size: 0.875rem;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
}

.kb-category-pill:hover {
  background: #e5e7eb;
  border-color: #d1d5db;
}

.kb-category-pill.active {
  background: #4f46e5;
  border-color: #4f46e5;
  color: white;
}

.kb-category-count {
  background: rgba(0, 0, 0, 0.1);
  padding: 0.125rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.kb-category-pill.active .kb-category-count {
  background: rgba(255, 255, 255, 0.2);
}

/* Results */
.kb-search-results {
  margin-top: 1.5rem;
}

.kb-loading {
  text-align: center;
  padding: 2rem;
  color: #6b7280;
}

.kb-no-results {
  text-align: center;
  padding: 2rem;
  color: #6b7280;
}

.kb-no-results p {
  margin: 0.5rem 0;
}

.kb-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 1rem;
  border-radius: 8px;
}

.kb-results-header {
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 1rem;
}

/* Article Cards */
.kb-article-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.kb-article-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 1.25rem;
  transition: all 0.2s;
  cursor: pointer;
}

.kb-article-card:hover {
  border-color: #4f46e5;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}

.kb-article-title {
  margin: 0 0 0.75rem 0;
  font-size: 1.125rem;
  line-height: 1.4;
}

.kb-article-title a {
  color: #4f46e5;
  text-decoration: none;
  font-weight: 600;
}

.kb-article-title a:hover {
  text-decoration: underline;
}

.kb-article-excerpt {
  color: #4b5563;
  margin: 0 0 1rem 0;
  line-height: 1.6;
}

.kb-article-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.875rem;
}

.kb-article-category {
  background: #dbeafe;
  color: #1e40af;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-weight: 500;
}

.kb-article-views {
  color: #6b7280;
}

.kb-article-tags {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

.kb-tag {
  background: #f3f4f6;
  color: #4b5563;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
}

/* Full Article Page */
.kb-article-full {
  background: white;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.kb-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #6b7280;
  text-decoration: none;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.kb-back-link:hover {
  color: #4f46e5;
}

.kb-article-header h1 {
  font-size: 2rem;
  margin: 0 0 1rem 0;
  color: #1a1a1a;
  line-height: 1.3;
}

.kb-article-meta-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 1rem;
}

.kb-article-category-badge {
  background: #dbeafe;
  color: #1e40af;
  padding: 0.375rem 0.875rem;
  border-radius: 16px;
  font-weight: 500;
}

.kb-article-views-count {
  color: #6b7280;
}

.kb-article-tags-header {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.kb-article-content {
  line-height: 1.8;
  color: #374151;
  margin: 2rem 0;
}

.kb-article-content h2 {
  font-size: 1.5rem;
  margin: 2rem 0 1rem 0;
  color: #1a1a1a;
}

.kb-article-content h3 {
  font-size: 1.25rem;
  margin: 1.5rem 0 0.75rem 0;
  color: #1a1a1a;
}

.kb-article-content p {
  margin: 1rem 0;
}

.kb-article-content ul,
.kb-article-content ol {
  margin: 1rem 0;
  padding-left: 2rem;
}

.kb-article-content li {
  margin: 0.5rem 0;
}

/* Inline Keyword Links */
.kb-inline-link {
  color: #4f46e5;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
}

.kb-inline-link:hover {
  color: #4338ca;
  text-decoration-thickness: 2px;
}

/* Feedback Section */
.kb-article-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid #e5e7eb;
}

.kb-feedback-section {
  background: #f9fafb;
  border-radius: 10px;
  padding: 1.5rem;
  text-align: center;
}

.kb-feedback-question {
  font-size: 1rem;
  color: #374151;
  margin: 0 0 1rem 0;
  font-weight: 500;
}

.kb-feedback-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.kb-feedback-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  border: 2px solid #e5e7eb;
  background: white;
  border-radius: 8px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.kb-feedback-btn:hover:not(:disabled) {
  border-color: #4f46e5;
  background: #f5f7ff;
}

.kb-feedback-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.kb-feedback-result {
  margin-top: 1rem;
  color: #059669;
  font-size: 0.875rem;
}

/* Related Articles */
.kb-related-section {
  background: #f9fafb;
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 2rem;
}

.kb-related-section h2 {
  font-size: 1.25rem;
  margin: 0 0 1rem 0;
  color: #1a1a1a;
}

.kb-related-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.kb-related-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: white;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  transition: all 0.2s;
}

.kb-related-item:hover {
  border-color: #4f46e5;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.1);
}

.kb-related-item a {
  color: #4f46e5;
  text-decoration: none;
  font-weight: 500;
}

.kb-related-item a:hover {
  text-decoration: underline;
}

.kb-related-views {
  font-size: 0.75rem;
  color: #9ca3af;
}

/* Responsive */
@media (max-width: 768px) {
  .kb-search-widget {
    padding: 1.5rem;
  }
  
  .kb-search-header h2 {
    font-size: 1.5rem;
  }
  
  .kb-article-full {
    padding: 1.5rem;
  }
  
  .kb-article-header h1 {
    font-size: 1.5rem;
  }
  
  .kb-article-meta-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .kb-article-meta-header > * {
    margin-bottom: 0.5rem;
  }
  
  .kb-feedback-buttons {
    flex-direction: column;
  }
  
  .kb-article-tags {
    margin-left: 0;
    margin-top: 0.5rem;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .kb-search-widget,
  .kb-article-full {
    background: #1f2937;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  }
  
  .kb-search-header h2,
  .kb-article-header h1,
  .kb-related-section h2,
  .kb-article-content h2,
  .kb-article-content h3 {
    color: #f9fafb;
  }
  
  .kb-search-subtitle,
  .kb-article-excerpt,
  .kb-article-content {
    color: #d1d5db;
  }
  
  .kb-search-box {
    background: #374151;
    border-color: #4b5563;
  }
  
  .kb-search-input {
    color: #f9fafb;
  }
  
  .kb-article-card {
    background: #374151;
    border-color: #4b5563;
  }
  
  .kb-related-item {
    background: #374151;
    border-color: #4b5563;
  }
}
