/* Загальні стилі — База знань LeadPrice */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  background: #fafafa; color: #111; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

.header {
  background: #fff; border-bottom: 1px solid #eaeaea; padding: 16px 32px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.logo { font-size: 18px; font-weight: 600; color: #111; text-decoration: none; }
.header-actions { display: flex; gap: 12px; align-items: center; }
.search-wrap { position: relative; width: 380px; }
.search {
  width: 100%; padding: 9px 14px 9px 38px; border: 1px solid #e5e5e5;
  border-radius: 8px; font-size: 14px; background: #fafafa;
  font-family: inherit;
}
.search:focus { outline: none; border-color: #111; background: #fff; }
.search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; opacity: 0.4;
}
.admin-btn {
  padding: 8px 16px; background: #111; color: #fff; border-radius: 8px;
  text-decoration: none; font-size: 13px; font-weight: 500;
}

.main { max-width: 1200px; margin: 0 auto; padding: 48px 32px; }
.main-narrow { max-width: 900px; margin: 0 auto; padding: 32px; }
.main-article { max-width: 760px; margin: 0 auto; padding: 32px; }

.hero { margin-bottom: 40px; }
.hero h1 {
  font-size: 32px; font-weight: 600; margin-bottom: 8px; letter-spacing: -0.5px;
}
.hero p { color: #666; font-size: 15px; }

.section-title {
  font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; color: #666; margin-bottom: 16px;
}

.categories {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px; margin-bottom: 48px;
}
.cat-card {
  background: #fff; border: 1px solid #eaeaea; border-radius: 12px;
  padding: 20px; transition: all 0.15s; text-decoration: none;
  color: inherit; display: block;
}
.cat-card:hover { border-color: #111; transform: translateY(-1px); }
.cat-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.cat-card .cat-count { font-size: 13px; color: #888; }

.materials-list {
  display: flex; flex-direction: column; background: #fff;
  border: 1px solid #eaeaea; border-radius: 12px; overflow: hidden;
}
.mat-item {
  padding: 16px 20px; border-bottom: 1px solid #f0f0f0;
  display: flex; align-items: center; justify-content: space-between;
  text-decoration: none; color: inherit; transition: background 0.1s;
}
.mat-item:last-child { border-bottom: none; }
.mat-item:hover { background: #fafafa; }
.mat-info h4 { font-size: 14px; font-weight: 500; margin-bottom: 2px; }
.mat-meta {
  font-size: 12px; color: #999; display: flex; gap: 12px; align-items: center;
}
.mat-tag {
  background: #f4f4f4; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 500; color: #555;
}
.mat-date { font-size: 12px; color: #999; white-space: nowrap; }

.breadcrumb { font-size: 13px; color: #666; margin-bottom: 20px; }
.breadcrumb a { color: #666; text-decoration: none; }
.breadcrumb a:hover { color: #111; }
.breadcrumb-sep { margin: 0 8px; color: #ccc; }

.cat-header { margin-bottom: 32px; }
.cat-header h1 {
  font-size: 28px; font-weight: 600; margin-bottom: 6px; letter-spacing: -0.5px;
}
.cat-header .count { color: #666; font-size: 14px; }

.article-header {
  margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid #eaeaea;
}
.article-header h1 {
  font-size: 34px; font-weight: 600; margin-bottom: 12px;
  letter-spacing: -0.5px; line-height: 1.25;
}
.article-meta {
  display: flex; gap: 16px; align-items: center;
  font-size: 13px; color: #888;
}

.content { font-size: 16px; color: #222; }
.content h1 { font-size: 26px; font-weight: 600; margin: 28px 0 12px; letter-spacing: -0.3px; }
.content h2 { font-size: 22px; font-weight: 600; margin: 32px 0 12px; letter-spacing: -0.3px; }
.content h3 { font-size: 17px; font-weight: 600; margin: 24px 0 8px; }
.content h4 { font-size: 15px; font-weight: 600; margin: 20px 0 8px; }
.content p { margin-bottom: 16px; }
.content ul, .content ol { margin: 0 0 16px 24px; }
.content li { margin-bottom: 6px; }
.content strong { font-weight: 600; }
.content em { font-style: italic; }
.content blockquote {
  border-left: 3px solid #111; padding: 4px 0 4px 16px;
  margin: 20px 0; color: #555; font-style: italic;
}
.content code {
  background: #f4f4f4; padding: 2px 6px; border-radius: 4px;
  font-family: 'SF Mono', Monaco, 'Courier New', monospace; font-size: 14px;
}
.content pre {
  background: #1a1a1a; color: #f4f4f4; padding: 16px;
  border-radius: 8px; overflow-x: auto; margin: 16px 0;
  font-family: 'SF Mono', Monaco, monospace; font-size: 13px;
}
.content pre code { background: none; padding: 0; color: inherit; }
.content img { max-width: 100%; height: auto; border-radius: 8px; margin: 16px 0; }
.content a { color: #111; text-decoration: underline; }
.content table {
  width: 100%; border-collapse: collapse; margin: 16px 0;
  font-size: 14px; display: block; overflow-x: auto;
}
.content th, .content td {
  padding: 10px 14px; border: 1px solid #eaeaea; text-align: left;
}
.content th { background: #fafafa; font-weight: 600; }
.content hr { border: none; border-top: 1px solid #eaeaea; margin: 24px 0; }
mark { background: #fff3a3; padding: 0 2px; border-radius: 2px; }

.empty-state {
  padding: 40px 20px; text-align: center; color: #888; font-size: 14px;
}
.loading {
  padding: 40px 20px; text-align: center; color: #999; font-size: 14px;
}

.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: #fff; border: 1px solid #eaeaea; border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.08);
  max-height: 400px; overflow-y: auto; z-index: 20; display: none;
}
.search-results.open { display: block; }
.sr-item {
  padding: 12px 16px; border-bottom: 1px solid #f0f0f0;
  text-decoration: none; color: inherit; display: block;
}
.sr-item:last-child { border-bottom: none; }
.sr-item:hover { background: #fafafa; }
.sr-title { font-size: 14px; font-weight: 500; margin-bottom: 2px; }
.sr-cat { font-size: 11px; color: #999; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.3px; }
.sr-excerpt { font-size: 12px; color: #666; line-height: 1.4; }
.sr-empty { padding: 20px; text-align: center; color: #999; font-size: 13px; }

@media (max-width: 768px) {
  .header { padding: 12px 16px; }
  .search-wrap { width: 180px; }
  .main, .main-narrow, .main-article { padding: 24px 16px; }
  .hero h1 { font-size: 24px; }
  .categories { grid-template-columns: 1fr; }
  .cat-header h1 { font-size: 22px; }
  .article-header h1 { font-size: 24px; }
  .content { font-size: 15px; }
  .content h2 { font-size: 19px; }
}
