/* ==========================================================================
   ИМПОРТ И ПЕРЕМЕННЫЕ
   ========================================================================== */
@import "./variables.css";

/* ==========================================================================
   ОБЩИЕ КНОПКИ И ЭЛЕМЕНТЫ ИНТЕРФЕЙСА
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent-color);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 15px var(--accent-glow);
}

/* ==========================================================================
   LAYOUT CONTAINERS (МЕТКИ И СЕТКА СТРАНИЦЫ)
   ========================================================================== */
.main-container {
  width: 1280px;
  max-width: 95%;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  align-items: stretch;
  flex: 1;
  padding-bottom: 18px;
  min-height: 0;
  overflow: hidden;
}

/* === Панели: Sidebar & Content === */
.sidebar, 
.content {
  background: var(--bg-surface);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  height: 100%;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.sidebar {
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.content {
  padding: 44px 56px;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   ШАПКА (HEADER)
   ========================================================================== */
header {
  width: 1280px;
  max-width: 95%;
  height: 64px;
  background: var(--bg-surface);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  margin: 16px 0 14px 0;
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
  transition: border-color var(--transition-normal);
}

header:hover {
  border-color: var(--border-highlight);
}

header .logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

header img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(99, 102, 241, 0.4));
}

.logo-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.logo-sub {
  font-style: italic;
  font-weight: 600;
  font-size: 11px;
  background: var(--accent-gradient);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-list-header {
  display: flex;
  align-items: center;
  gap: 22px;
  list-style: none;
}

.separator {
  color: rgba(255, 255, 255, 0.12);
  user-select: none;
}

.nav-header-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color var(--transition-fast), text-shadow var(--transition-fast);
}

.nav-header-link:hover,
.nav-header-link.active {
  color: var(--text-primary);
  text-shadow: 0 0 12px var(--accent-glow);
}

/* Мобильное меню */
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  cursor: pointer;
  transition: all var(--transition-normal);
}

.menu-toggle:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-highlight);
}

.menu-toggle span,
.menu-toggle span::before,
.menu-toggle span::after {
  display: block;
  width: 18px;
  height: 2px;
  background-color: var(--text-secondary);
  border-radius: 99px;
  transition: transform var(--transition-normal), opacity var(--transition-normal);
  position: relative;
}

.menu-toggle span::before,
.menu-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
}

.menu-toggle span::before { top: -6px; }
.menu-toggle span::after { top: 6px; }

.menu-toggle.open span { transform: rotate(45deg); }
.menu-toggle.open span::before { transform: rotate(90deg); top: 0; }
.menu-toggle.open span::after { opacity: 0; }

/* ==========================================================================
   БОКОВАЯ НАВИГАЦИЯ (SIDEBAR NAV)
   ========================================================================== */
.nav-group {
  margin-bottom: 22px;
}

.nav-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-faded);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 0 10px;
  margin-bottom: 10px;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 9px 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 10px;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.nav-link:hover {
  color: var(--text-primary);
  background-color: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.05);
}

.nav-link.active,
.sub-link.active {
  background: var(--accent-glow);
  color: var(--text-primary);
  font-weight: 600;
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
}

.nav-link.dropdown,
.dropdown-toggle {
  justify-content: space-between;
  cursor: pointer;
}

.link-left {
  display: flex;
  align-items: center;
}

.nav-icon {
  width: 16px;
  height: 16px;
  margin-right: 10px;
  object-fit: contain;
  opacity: 0.85;
}

.arrow-icon {
  width: 12px;
  height: 12px;
  stroke: var(--text-faded);
  transition: transform var(--transition-normal);
  transform-origin: center;
}

.dropdown-toggle:not(.open) .arrow-icon {
  transform: rotate(-90deg);
}

.dropdown-wrapper {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: var(--transition-dropdown);
}

.dropdown-wrapper.open {
  grid-template-rows: 1fr;
  opacity: 1;
}

.dropdown-wrapper > .sub-menu {
  overflow: hidden;
}

.sub-menu {
  list-style: none;
  margin-left: 18px;
  padding-left: 12px;
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 6px;
}

.sub-link {
  display: flex;
  align-items: center;
  padding: 7px 10px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  border-radius: 8px;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  white-space: nowrap;
}

.sub-link:hover {
  color: var(--text-primary);
  background-color: var(--bg-card);
}

/* Discord Footer Card */
.sidebar-footer {
  margin-top: auto;
  padding-top: 18px;
}

.discord-card {
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.1) 0%, rgba(0, 0, 0, 0.3) 100%);
  border: 1px solid rgba(88, 101, 242, 0.25);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.discord-card:hover {
  border-color: rgba(88, 101, 242, 0.5);
  box-shadow: 0 0 15px rgba(88, 101, 242, 0.2);
}

.discord-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.discord-icon {
  width: 30px;
  height: 30px;
  background-color: #5865F2;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(88, 101, 242, 0.4);
}

.discord-icon svg {
  width: 17px;
  height: 17px;
  fill: #fff;
}

.discord-text {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}

.settings-btn {
  background: transparent;
  border: none;
  color: var(--text-faded);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.settings-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.settings-btn svg {
  width: 15px;
  height: 15px;
}

/* ==========================================================================
   ПОИСК И МОДАЛЬНОЕ ОКНО ПОИСКА
   ========================================================================== */
.search {
  width: 230px;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0 12px;
  transition: all var(--transition-normal);
  cursor: pointer;
  user-select: none;
}

.search:focus-within {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-glow), 0 0 0 1px var(--accent-primary);
  background-color: rgba(0, 0, 0, 0.6);
}

.search-icon {
  width: 15px;
  height: 15px;
  stroke: var(--text-faded);
  transition: stroke var(--transition-fast);
  flex-shrink: 0;
}

.search:focus-within .search-icon {
  stroke: var(--accent-hover);
}

.search input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  width: 100%;
}

.search input::placeholder {
  color: var(--text-faded);
}

.search .search-placeholder {
  color: var(--text-faded);
  font-size: 13px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-shortcut {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  user-select: none;
  pointer-events: none;
}

/* Модальное окно */
.search-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 10vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  visibility: hidden;
}

.search-modal.active {
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
}

.search-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.search-modal-container {
  position: relative;
  width: 100%;
  max-width: 620px;
  margin: 0 16px;
  background: rgba(15, 17, 23, 0.95);
  border: 1px solid var(--border-highlight);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
  transform: translateY(-10px);
  transition: transform 0.2s ease;
}

.search-modal.active .search-modal-container {
  transform: translateY(0);
}

.search-modal-header {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
}

.search-modal-header .search-icon {
  width: 18px;
  height: 18px;
  stroke: var(--text-muted);
  flex-shrink: 0;
}

.search-modal-header input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
}

.search-modal-header input::placeholder {
  color: var(--text-faded);
}

.search-modal-body {
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background var(--transition-fast);
}

.search-result-item:hover {
  background: var(--bg-card-hover);
}

.search-result-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}

.search-result-info {
  flex: 1;
  min-width: 0;
}

.search-result-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-desc {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.search-result-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.search-result-item mark {
  background: rgba(99, 102, 241, 0.3);
  color: var(--accent-light);
  border-radius: 2px;
  padding: 0 2px;
}

.search-no-results {
  padding: 30px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.search-no-results span {
  color: var(--text-primary);
}

/* ==========================================================================
   ОФОРМЛЕНИЕ СТАТЕЙ И КОНТЕНТА (ARTICLE CONTENT)
   ========================================================================== */

/* Хлебные крошки */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.breadcrumb-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  opacity: 0.6;
}

.breadcrumb-separator {
  color: var(--text-faded);
  font-size: 11px;
  opacity: 0.5;
}

/* Заголовок и описание страницы */
.page-title {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.title-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(99, 102, 241, 0.3));
}

.description {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 36px;
  font-weight: 400;
}

/* Секции контента */
.content-section {
  margin-bottom: 36px;
}

.content-section h2 {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  scroll-margin-top: 20px;
}

.content-section h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 16px;
  margin-bottom: 6px;
}

.content-section p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-muted);
}

/* Списки */
.content-section ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.content-section ul li {
  position: relative;
  padding-left: 22px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.content-section ul li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 10px;
  width: 6px;
  height: 6px;
  background: var(--accent-gradient);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-primary);
}

.ordered-steps {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0;
  color: var(--text-secondary);
  font-size: 15px;
}

.ordered-steps li {
  line-height: 1.65;
}

/* Ссылки внутри текста */
.content-section ul li a,
.inline-link {
  color: var(--accent-hover);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px rgba(129, 140, 248, 0.4) dashed;
  transition: all var(--transition-fast);
}

.content-section ul li a:hover,
.inline-link:hover {
  color: var(--accent-light);
  border-bottom-style: solid;
  border-bottom-color: var(--accent-light);
  text-shadow: 0 0 8px var(--accent-glow);
}

/* Медиа-элементы и карточки */
.content-image-wrapper {
  margin: 24px 0;
  display: flex;
  justify-content: center;
}

.article-img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
}

.motd-img {
  max-width: 520px;
  width: 100%;
}

.demo-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  margin-top: 24px;
}

.demo-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 12px;
  display: inline-block;
  max-width: 540px;
  width: 100%;
  box-shadow: var(--shadow-md);
  transition: border-color var(--transition-normal);
}

.demo-card:hover {
  border-color: var(--border-highlight);
}

.demo-card img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
  object-fit: cover;
}

.demo-badge {
  position: absolute;
  bottom: 24px;
  right: 24px;
  background: rgba(10, 10, 14, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  box-shadow: var(--shadow-sm);
}

/* Карточки связанных материалов */
.related-cards {
  display: flex;
  gap: 16px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.related-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px 20px;
  text-decoration: none;
  color: var(--text-primary);
  width: auto;
  transition: all var(--transition-normal);
}

.related-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow-glow);
}

.related-card-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  opacity: 0.9;
  flex-shrink: 0;
}

.related-card-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Компонент правил */
.rules-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}

.rule-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all var(--transition-normal);
}

.rule-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-accent);
}

.rule-text {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--text-secondary);
}

.rule-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-light);
  background: var(--accent-glow);
  border: 1px solid var(--border-accent);
  border-radius: 6px;
  padding: 2px 8px;
  margin-right: 10px;
  vertical-align: middle;
}

.rule-punishment {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
  padding-top: 10px;
  border-top: 1px dashed var(--border-subtle);
  flex-wrap: wrap;
}

.punishment-tag {
  background-color: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 9px;
  border-radius: 6px;
  flex-shrink: 0;
}

/* ==========================================================================
   НАВИГАЦИЯ В ФУТЕРЕ И МЕЖДУ СТРАНИЦАМИ
   ========================================================================== */
.next-page-card,
.page-navigation {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.page-navigation {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
}

.next-page-card { 
  justify-content: flex-end; 
}

.page-navigation > .next-page:only-child { margin-left: auto; }
.page-navigation > .prev-page:only-child { margin-right: auto; }

.next-page-link,
.nav-page-btn {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  transition: all var(--transition-fast);
}

.next-page-link { 
  text-align: right; 
  display: inline-flex;
  gap: 6px;
  padding: 14px 22px;
  border-radius: 12px;
  transition: all var(--transition-normal);
}

.nav-page-btn { 
  min-width: 170px;
  max-width: 280px; /* Ограничивает максимальную ширину кнопки */
  flex: 1;          /* Позволяет кнопкам сжиматься или расти равномерно */
}

.prev-page { text-align: left; }
.next-page { 
  text-align: right;
  grid-column: 2;
}

.next-page-link:hover,
.nav-page-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-highlight);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.next-label,
.nav-page-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.05em;
}

.next-title,
.nav-page-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  transition: color var(--transition-fast);
}

.next-page-link:hover .next-title,
.nav-page-btn:hover .nav-page-title {
  color: var(--accent-hover);
}