/* assets/css/style.css */
:root {
  --bg-code: #acacac;
  --accent: #2b2b2b;
}
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  scroll-padding-top: 70px;
}
body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 0;
  line-height: 1.6;
  color: #333;
  background: #f9f9f9;
}
nav {
  position: fixed;
  top: 0;
  width: 100%;
  background: #2c3e50;
  padding: 10px 20px;
  z-index: 2;
}
nav a {
  color: #ecf0f1;
  text-decoration: none;
  margin-right: 15px;
}
nav a:hover {
  text-decoration: underline;
}
footer {
  position: fixed;
  bottom: 0;
  width: 100%;
  text-align: center;
  background: #34495e;
  color: #ecf0f1;
  margin-top: 50px;
}

.inline-form {
  display: inline;
  margin: 0;
}
.error {
  color: #e74c3c;
  background: #fadbd8;
  padding: 8px;
  border-radius: 4px;
  margin: 10px 0;
}
.success {
  color: #27ae60;
  background: #d5f5e3;
  padding: 8px;
  border-radius: 4px;
  margin: 10px 0;
}

/* Стили для кода */
code {
  position: relative;
  background-color: var(--bg-code);
  color: var(--accent);
  padding: 4px 8px;
  margin: 0 2px;
  border-radius: 4px;
  font-family: "Courier New", monospace;
  font-size: 0.95em;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s ease;
}

pre {
  position: relative;
  background-color: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  margin: 15px 0;
  overflow-x: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 0.95em;
  color: var(--accent);
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}

code:hover {
  background-color: var(--bg-code-hover);
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--shadow-lg);
}

pre:hover {
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--shadow-lg);
}

/* Подсказка при копировании */
.copied-tip {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #000;
  font-size: 0.8em;
  padding: 4px 12px;
  border-radius: 4px;
  font-weight: bold;
  opacity: 0;
  transition: opacity 0.2s;
  white-space: nowrap;
  pointer-events: none;
}

/* Базовая кнопка/ссылка-кнопка */
.btn,
a.btn {
  display: inline-block;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: #2c3e50; /* — основной цвет (как у навигации) */
  color: #ecf0f1;
  line-height: 1.4;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* hover/active/focus */
.btn:hover,
a.btn:hover {
  background-color: #34495e;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn:active,
a.btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn:focus,
a.btn:focus {
  outline: 2px solid #3498db;
  outline-offset: 2px;
}

.btn-secondary,
a.btn-secondary {
  background-color: #0a83ee;
  color: #ecf0f1;
}

.btn-secondary:hover,
a.btn-secondary:hover {
  background-color: #2a91eb;
}

.btn-small {
  padding: 1px 5px;
  font-size: 0.85rem;
}

.page-files {
  margin-top: 20px;
}

.page-file-image {
  max-width: 200px;
  height: auto;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 4px;
  margin: 4px;
  transition: transform 0.2s;
}

.page-file-image:hover {
  transform: scale(1.05);
  cursor: pointer;
}

.page-file-link {
  display: block;
  padding: 8px 12px;
  background: #f0f0f0;
  border-radius: 4px;
  margin: 4px 0;
}

/* Toast-уведомление-скопировано */
.copied-toast {
  position: fixed;
  top: 20px;
  right: -300px;
  background-color: green;
  color: #ffffff;
  font-family: "Courier New", monospace;
  font-weight: bold;
  padding: 12px 20px;
  border-radius: 6px;
  box-shadow: 0 4px 12px var(--shadow-md);
  transition: right 0.3s ease-in-out;
  z-index: 1000;
  pointer-events: none;
  white-space: pre;
}

/* ========= 3-колоночный макет ========== */
/* Общая обёртка для левого, центрального и правого блоков */
body > nav + aside + main + aside + footer {
  display: flex;
  flex-wrap: wrap;
  min-height: 100vh;
}

/* Левое меню (боковое) */
aside.sidebar-left {
  order: 1;
  width: 240px;
  position: fixed;
  left: 0;
  top: 0;
  height: 100%;
  background: #2c3e50;
  color: #ecf0f1;
  padding-top: 60px;
  overflow-y: auto;
  transition: transform 0.3s ease;
  z-index: 1;
}

aside.sidebar-left h2 {
  padding: 15px 20px;
  margin: 0;
  font-size: 1.2em;
  border-bottom: 1px solid #34495e;
}

aside.sidebar-left ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

aside.sidebar-left li {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

aside.sidebar-left li a {
  display: block;
  padding: 12px 20px;
  color: #ecf0f1;
  text-decoration: none;
  transition: background 0.2s;
  z-index: 1;
}

aside.sidebar-left li a:hover {
  background: rgba(255, 255, 255, 0.1);
  padding-left: 25px;
}

/* Обёртка для 3-колоночной верстки */
.layout-wrapper {
  display: flex;
  flex-wrap: wrap;
  min-height: calc(100vh - 50px - 40px); /* вычитаем высоты nav и footer */
}

/* Левое меню (боковое) */
aside.sidebar-left {
  order: 1;
  width: 240px;
  position: fixed;
  left: 0;
  top: 0;
  height: 100%;
  background: #2c3e50;
  color: #ecf0f1;
  padding-top: 60px;
  overflow-y: auto;
  transition: transform 0.3s ease;
  z-index: 1;
}

/* Главный контент */
main {
  order: 2;
  flex: 1;
  min-width: 300px;
  margin-left: 240px; /* чтобы не перекрывал sidebar-left */
  padding: 20px;
  padding-top: 70px;
  padding-bottom: 70px;
  scroll-margin-top: 70px;
}

/* Правое меню (доп. колонка) */
aside.sidebar-right {
  order: 3;
  width: 280px;
  padding-top: 70px;
}

/* Обёртка контента внутри правой колонки */
aside.sidebar-right .sidebar-content {
  position: sticky;
  top: 50px;
  max-height: calc(100vh - 50px - 40px);
  overflow-y: auto;
  float: right;
  max-width: 280px;
  padding: 10px 15px;
  background-color: #f0f0f0;
  border-radius: 6px;
  font-size: 0.9em;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge legacy */
}
aside.sidebar-right .sidebar-content h3 {
  margin-top: 0;
  font-size: 1em;
  border-bottom: 1px solid #ccc;
  padding-bottom: 6px;
}

aside.sidebar-right .sidebar-content h4 {
  margin: 10px 0 4px;
  font-size: 0.95em;
}

aside.sidebar-right ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

aside.sidebar-right li {
  margin: 4px 0;
}

aside.sidebar-right li a {
  color: #34495e;
  text-decoration: none;
  display: block;
  padding: 2px 6px;
}

aside.sidebar-right li a:hover {
  background: #e8f0fe;
  border-radius: 3px;
}

/* Рекламный блок */
aside.sidebar-right .ad-box {
  margin-top: 15px;
  padding: 10px;
  background: #fff;
  border: 1px dashed #ccc;
  text-align: center;
  font-size: 0.85em;
}

aside.sidebar-right .ad-box small {
  color: #777;
}

/* Контакты и другие блоки */
aside.sidebar-right .sidebar-block {
  margin-top: 15px;
  padding: 10px;
  background: #f9f9f9;
  border-radius: 4px;
}
/* === Модуль поделиться страницей === */
.share-module {
  margin-top: 30px;
  padding: 15px 20px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  text-align: center;
}

.share-module h4 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1em;
  color: #34495e;
}

.share-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.2s;
  color: #fff;
  border: none;
  cursor: pointer;
  background: #2c3e50;
}

.share-btn.telegram {
  background: #229ed9;
}
.share-btn.vk {
  background: #0077ff;
}
.share-btn.whatsapp {
  background: #25d366;
}
.share-btn.twitter {
  background: #1da1f2;
}
.share-btn.copy-link {
  background: #27ae60;
}

.share-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.share-btn:active {
  transform: translateY(0);
}

.share-tip {
  font-size: 0.85em;
  color: #666;
  margin: 0;
}

.breadcrumbs ol {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: flex;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: #666;
}

.breadcrumbs li::after {
  content: " / ";
  margin: 0 0.4rem;
}

.breadcrumbs li:last-child::after {
  content: "";
}

.breadcrumbs a {
  color: #007bff;
  text-decoration: none;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

/* Адаптивность для мобильных */
@media (max-width: 968px) {
  body > nav + aside + main + aside + footer {
    flex-direction: column;
    min-height: auto;
  }

  aside.sidebar-left {
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    width: 240px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1000;
  }

  aside.sidebar-left.open {
    transform: translateX(0);
  }
  
  aside.sidebar-right {
    order: 4;
    margin-top: 20px;
    max-width: 100%;
    width: 100%;
  }

  main {
    margin-left: 0;
    margin-top: 50px;
    margin-right: 0;
    padding: 20px;
  }

  .menu-toggle {
    position: fixed;
    right: 15px;
    top: 10px;
    z-index: 1001;
    background: #2c3e50;
    color: #ecf0f1;
    border: none;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
  }

  .menu-toggle {
    position: fixed;
    right: 15px;
    top: 0px;
    z-index: 1001;
    background: #2c3e50;
    color: #ecf0f1;
    border: none;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
  }

  .menu-toggle span {
    font-size: 1.5em;
  }

  .btn,
  a.btn {
    width: 100%;
    margin-bottom: 8px;
  }
}
/* Поддержка dark mode (опционально) */
@media (prefers-color-scheme: dark) {
  .btn {
    background-color: #34495e;
    color: #ecf0f1;
  }
  .btn:hover {
    background-color: #2c3e50;
  }
}
