/* knowledge-base.css - Десктопные стили для Базы знаний (страницы index, category, article) */
/* Подключается в base.html через block extra_css */

/* ==================== ОБЩИЕ СТИЛИ ДЛЯ БАЗЫ ЗНАНИЙ ==================== */

:root {
  --dark-blue: #0D1A29;
  --light-beige: #F8F4F2;
  --sea-turquoise: #5FAAB8;
  --card-bg: #ffffff;
  --text: var(--dark-blue);
  --muted: rgba(13,26,41,0.65);
  --green: #1a9b5a;
  --red: #d9534f;
  --shadow: 0 8px 20px rgba(13,26,41,0.06);
  --section-bg: rgba(95,170,184,0.05);
  --body-bg: var(--light-beige);
  --border: rgba(13,26,41,0.1);
  --border-light: rgba(13,26,41,0.05);
}

:root[data-theme="dark"] {
  --card-bg: #1A2837;
  --text: #F8F4F2;
  --muted: rgba(248,244,242,0.72);
  --shadow: 0 8px 30px rgba(0,0,0,0.4);
  --section-bg: rgba(95,170,184,0.08);
  --body-bg: #0F1720;
  --border: rgba(248,244,242,0.1);
  --border-light: rgba(248,244,242,0.05);
  color-scheme: dark;
}

/* ==================== КОМПОНЕНТЫ ГЛАВНОЙ СТРАНИЦЫ (index.html) ==================== */

/* Секция "Популярные материалы" */
.featured-section {
  background: var(--section-bg);
  padding: 30px;
  border-radius: 12px;
  margin-bottom: 40px;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.featured-card {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 20px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}

.featured-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 15px 30px rgba(13,26,41,0.1);
}

.featured-badge {
  background: var(--sea-turquoise);
  color: white;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-block;
  margin-bottom: 12px;
}

.featured-title {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 10px;
}

.featured-desc {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 15px;
}

.featured-link {
  color: var(--sea-turquoise);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  display: inline-block;
}

/* Секция "Структура базы знаний" */
.kb-structure {
  margin-bottom: 40px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.category-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(13,26,41,0.04);
  transition: transform .12s ease, box-shadow .12s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.category-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(13,26,41,0.08);
}

.category-header {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
}

.category-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(95,171,184,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--sea-turquoise);
  font-size: 1.2rem;
  margin-right: 12px;
}

.category-title {
  font-weight: 700;
  font-size: 1.2rem;
  flex: 1;
}

.category-count {
  background: var(--sea-turquoise);
  color: white;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.category-desc {
  color: var(--muted);
  margin-bottom: 15px;
  flex: 1;
}

/* Секция "Ключевые показатели" */
.articles-list {
  margin-bottom: 30px;
}

.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.article-item {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 16px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--sea-turquoise);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}

.article-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 15px 30px rgba(13,26,41,0.1);
}

.article-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 8px;
  color: var(--text);
  line-height: 1.4;
}

/* ==================== СТИЛИ ДЛЯ КАРТОЧЕК В БЛОКЕ "КЛЮЧЕВЫЕ ПОКАЗАТЕЛИ" ==================== */
.article-item .article-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 8px;
  color: var(--text);
  line-height: 1.4;
}

/* Контент статьи */
.article-content {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 40px;
  box-shadow: var(--shadow);
  margin-bottom: 40px;
  line-height: 1.8;
  font-size: 1.05rem;
}

.article-desc {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Стили для приглушенных карточек (inactive) */
.featured-card.inactive,
.article-item.inactive,
.category-card.inactive {
  opacity: 0.6;
  cursor: not-allowed !important;
}

.featured-card.inactive:hover,
.article-item.inactive:hover,
.category-card.inactive:hover {
  transform: none !important;
  box-shadow: var(--shadow) !important;
}

/* Подсказка для администратора */
.hint-message {
  background: #fff3cd;
  border: 1px solid #ffeeba;
  color: #856404;
  padding: 15px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.95rem;
}

.hint-message code {
  background: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  color: #d63384;
}

:root[data-theme="dark"] .hint-message {
  background: rgba(255, 243, 205, 0.1);
  border-color: rgba(255, 238, 186, 0.2);
  color: #ffd966;
}

:root[data-theme="dark"] .hint-message code {
  background: rgba(255, 255, 255, 0.1);
  color: #ffb3b3;
}

/* ==================== СТИЛИ ДЛЯ СТРАНИЦЫ КАТЕГОРИИ (category.html) ==================== */

.category-header-block {
  background: var(--section-bg);
  border-radius: 12px;
  padding: 30px;
  margin-bottom: 30px;
  border: 1px solid var(--border-light);
}

.category-icon-large {
  font-size: 3rem;
  margin-bottom: 15px;
}

.category-title-large {
  font-family: Montserrat, Inter, sans-serif;
  font-weight: 700;
  font-size: 2rem;
  margin-bottom: 10px;
  color: var(--text);
}

.category-description {
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 800px;
  margin-bottom: 20px;
  line-height: 1.6;
}

.category-meta {
  display: flex;
  gap: 20px;
  color: var(--muted);
  font-size: 0.95rem;
}

.category-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Карточки статей в категории */
.articles-section {
  margin-bottom: 40px;
}

.article-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  transition: transform .12s ease, box-shadow .12s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.article-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 15px 30px rgba(13,26,41,0.1);
}

.article-card .article-meta {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 0.85rem;
}

.article-card .article-date {
  color: var(--muted);
}

.article-card .article-badge {
  background: var(--sea-turquoise);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
}

.article-card .article-title {
  font-weight: 700;
  font-size: 1.2rem;
  margin-bottom: 12px;
  color: var(--text);
}

.article-card .article-excerpt {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 16px;
  flex: 1;
  line-height: 1.5;
}

.article-card .article-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.article-card .article-read-more {
  color: var(--sea-turquoise);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.article-card .article-views {
  color: var(--muted);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Пустое состояние для категории */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--section-bg);
  border-radius: 12px;
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text);
}

.empty-state-text {
  color: var(--muted);
  margin-bottom: 20px;
}

.empty-state-button {
  display: inline-block;
  padding: 12px 24px;
  background: var(--sea-turquoise);
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  transition: background .12s ease;
}

.empty-state-button:hover {
  background: #4a9ca8;
}

/* ==================== СТИЛИ ДЛЯ СТРАНИЦЫ СТАТЬИ (article.html) ==================== */

/* Заголовок статьи */
.article-header {
  margin-bottom: 30px;
}

.article-category {
  display: inline-block;
  background: var(--sea-turquoise);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 15px;
  text-decoration: none;
}

.article-category:hover {
  background: #4a9ca8;
}

.article-title {
  font-family: Montserrat, Inter, sans-serif;
  font-weight: 700;
  font-size: 2.2rem;
  margin-bottom: 15px;
  color: var(--text);
  line-height: 1.3;
}

.article-meta {
  display: flex;
  gap: 20px;
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 20px;
}

.article-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.article-excerpt {
  font-size: 1.2rem;
  color: var(--text);
  background: var(--section-bg);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 30px;
  border-left: 4px solid var(--sea-turquoise);
}

/* Контент статьи */
.article-content {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 40px;
  box-shadow: var(--shadow);
  margin-bottom: 40px;
  line-height: 1.8;
  font-size: 1.05rem;
}

.article-content h2 {
  font-family: Montserrat, Inter, sans-serif;
  font-weight: 700;
  font-size: 1.6rem;
  margin: 30px 0 15px;
  color: var(--text);
}

.article-content h3 {
  font-family: Montserrat, Inter, sans-serif;
  font-weight: 600;
  font-size: 1.3rem;
  margin: 25px 0 12px;
  color: var(--text);
}

.article-content h4 {
  font-weight: 600;
  font-size: 1.1rem;
  margin: 20px 0 10px;
  color: var(--text);
}

.article-content p {
  margin-bottom: 20px;
}

.article-content ul,
.article-content ol {
  margin: 15px 0 20px 25px;
}

.article-content li {
  margin-bottom: 8px;
}

.article-content a {
  color: var(--sea-turquoise);
  text-decoration: none;
}

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

.article-content blockquote {
  background: var(--section-bg);
  border-left: 4px solid var(--sea-turquoise);
  padding: 15px 20px;
  margin: 20px 0;
  font-style: italic;
  color: var(--muted);
}

.article-content code {
  background: var(--section-bg);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: monospace;
}

.article-content pre {
  background: var(--section-bg);
  padding: 15px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 20px 0;
}

.article-content pre code {
  background: transparent;
  padding: 0;
}

.article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 20px 0;
}

.article-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 20px 0;
}

.article-content th {
  background: var(--section-bg);
  padding: 10px;
  text-align: left;
  font-weight: 600;
}

.article-content td {
  padding: 10px;
  border-bottom: 1px solid var(--border-light);
}

/* Подвал статьи */
.article-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 30px;
  padding-top: 30px;
  border-top: 1px solid var(--border-light);
}

.article-stats {
  display: flex;
  gap: 15px;
  color: var(--muted);
}

.article-vote {
  display: flex;
  gap: 10px;
}

.vote-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  border: 2px solid transparent;
  border-radius: 30px;
  background: var(--section-bg);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: all .2s ease;
}

.vote-btn.like:hover {
  border-color: var(--green);
  color: var(--green);
}

.vote-btn.dislike:hover {
  border-color: var(--red);
  color: var(--red);
}

.vote-btn.voted.like {
  border-color: var(--green);
  color: var(--green);
  background: rgba(26,155,90,0.1);
}

.vote-btn.voted.dislike {
  border-color: var(--red);
  color: var(--red);
  background: rgba(217,83,79,0.1);
}

/* Навигация между статьями */
.article-navigation {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 40px 0;
}

.navigation-prev,
.navigation-next {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  transition: transform .12s ease;
}

.navigation-prev:hover,
.navigation-next:hover {
  transform: translateY(-2px);
}

.navigation-prev a,
.navigation-next a {
  text-decoration: none;
  color: var(--text);
}

.navigation-label {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.navigation-title {
  font-weight: 600;
  color: var(--sea-turquoise);
}

.navigation-prev {
  text-align: left;
}

.navigation-next {
  text-align: right;
}

.navigation-empty {
  background: var(--section-bg);
  padding: 20px;
  border-radius: 8px;
  color: var(--muted);
  font-style: italic;
}

/* ==================== ХЛЕБНЫЕ КРОШКИ (общие для всех страниц БЗ) ==================== */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 0.95rem;
}

.breadcrumb a {
  color: var(--sea-turquoise);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb .current {
  color: var(--text);
  font-weight: 500;
}

/* ==================== ТЕМНАЯ ТЕМА ==================== */

:root[data-theme="dark"] .featured-card,
:root[data-theme="dark"] .category-card,
:root[data-theme="dark"] .article-item,
:root[data-theme="dark"] .article-card,
:root[data-theme="dark"] .article-content,
:root[data-theme="dark"] .navigation-prev,
:root[data-theme="dark"] .navigation-next {
  background: var(--card-bg);
  border-color: rgba(255,255,255,0.1);
}

:root[data-theme="dark"] .featured-section,
:root[data-theme="dark"] .category-header-block,
:root[data-theme="dark"] .empty-state,
:root[data-theme="dark"] .navigation-empty {
  background: rgba(255,255,255,0.03);
}

:root[data-theme="dark"] .article-excerpt {
  background: rgba(255,255,255,0.05);
}

:root[data-theme="dark"] .vote-btn {
  background: rgba(255,255,255,0.05);
}

:root[data-theme="dark"] .vote-btn.voted.like {
  background: rgba(26,155,90,0.2);
}

:root[data-theme="dark"] .vote-btn.voted.dislike {
  background: rgba(217,83,79,0.2);
}

:root[data-theme="dark"] .article-content blockquote,
:root[data-theme="dark"] .article-content pre,
:root[data-theme="dark"] .article-content code {
  background: rgba(255,255,255,0.05);
}

:root[data-theme="dark"] .article-content th {
  background: rgba(255,255,255,0.05);
}

:root[data-theme="dark"] .article-content td {
  border-bottom-color: rgba(255,255,255,0.05);
}