/* =============================================
СТИЛЬ С ПЕРЕКЛЮЧАТЕЛЕМ ТЕМЫ
============================================= */
:root {
  --bg-primary: #fcfcf9;
  --bg-secondary: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --border-color: #e0e0e0;
  --accent-color: #4f46e5;
  --card-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
[data-theme="dark"] {
  --bg-primary: #100e12;
  --bg-secondary: #1a181f;
  --text-primary: #f0f0f0;
  --text-secondary: #a0a0a0;
  --border-color: #333333;
  --card-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* ===== Базовые стили ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  transition: background-color 0.3s, color 0.3s;
}

.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  box-shadow: var(--card-shadow);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  fill: var(--text-primary);
}

a {
  color: var(--accent-color);
  text-decoration: none;
}

button, .btn {
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

button:hover, .btn:hover {
  opacity: 0.9;
}

.card {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border-color);
}

h1, h2, h3 {
  margin-bottom: 16px;
  font-weight: 700;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 14px;
  color: var(--text-primary);
}

input[type="text"],
select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 16px;
  transition: border-color 0.2s;
}

input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: var(--accent-color);
}

.form-group {
  margin-bottom: 16px;
}

header {
  text-align: center;
  margin-bottom: 32px;
  padding: 20px 0;
}

h1 {
  font-size: 28px;
  background: linear-gradient(90deg, #4f46e5, #7c3aed);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.success {
  background: #d1fae5;
  color: #065f46;
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 24px;
  text-align: center;
  font-weight: 500;
}

[data-theme="dark"] .success {
  background: #0c4a35;
  color: #68d391;
}

/* === РАСПОЛОЖЕНИЕ ОТНОСИТЕЛЬНО ПАНЕЛИ === */
.main-content-with-sidebar {
  margin-left: 240px;
  padding: 20px;
  min-height: 100vh;
}
.sidebar.collapsed ~ .main-content-with-sidebar {
  margin-left: 60px;
}
@media (max-width: 768px) {
  .main-content-with-sidebar {
    margin-left: 60px;
    padding: 15px;
  }
}

/* === СТИЛИ ДЛЯ СТАТЬИ === */
.article-content h2,
.article-content h3 {
  margin: 24px 0 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.article-content h2 {
  font-size: 22px;
  border-bottom: 2px solid var(--accent-color);
  padding-bottom: 8px;
}
.article-content h3 {
  font-size: 18px;
}
.article-content p {
  margin: 16px 0;
}
.article-content ul,
.article-content ol {
  margin: 16px 0 16px 24px;
}
.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}
.article-content th,
.article-content td {
  padding: 12px;
  border: 1px solid var(--border-color);
  text-align: left;
}
.article-content th {
  background: var(--bg-secondary);
  font-weight: 600;
}
@media (max-width: 600px) {
  .article-content table {
    display: block;
    overflow-x: auto;
  }
}

/* === СОВРЕМЕННЫЙ СТИЛЬ СТАТЕЙ (ОБНОВЛЁННЫЙ) === */

/* Оглавление */
.toc {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 2rem;
  border: 1px solid var(--border-color);
  max-height: 80vh;
  overflow-y: auto;
}
.toc h4 {
  margin: 0 0 12px 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.toc li {
  margin-bottom: 8px;
}
.toc a {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toc a:hover {
  color: var(--accent-color);
}

/* Заголовки */
.article-content-preview h1,
.article-content-preview h2,
.article-content-preview h3 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  line-height: 1.4;
}
.article-content-preview h1 {
  font-size: 2rem;
  color: var(--accent-color);
  text-align: center;
  margin-bottom: 2rem;
}
.article-content-preview h2 {
  font-size: 1.5rem;
  position: relative;
  padding-left: 32px;
}
.article-content-preview h2 svg {
  position: absolute;
  left: 0;
  top: 0.25em;
  width: 24px;
  height: 24px;
  color: var(--accent-color);
}

.article-content-preview p {
  margin-bottom: 1.5rem;
  line-height: 1.6;
  color: var(--text-primary);
}

/* Алерты */
.alert {
  padding: 16px 20px 16px 52px;
  border-radius: 12px;
  margin: 24px 0;
  position: relative;
  font-size: 15px;
  line-height: 1.6;
}
.alert::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
}
.alert.success {
  background: #e6f7ee;
  border-left: 4px solid #059669;
}
.alert.success::before {
  content: url("/static/icons/lucide/check-circle.svg");
}
.alert.warning {
  background: #fff7ed;
  border-left: 4px solid #d97706;
}
.alert.warning::before {
  content: url("/static/icons/lucide/alert-triangle.svg");
}
.alert.tip {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
}
.alert.tip::before {
  content: url("/static/icons/lucide/lightbulb.svg");
}

/* Карточки методов */
.method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin: 24px 0;
}
.method-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.method-card:hover {
  transform: translateY(-4px);
}
.method-card h3 {
  margin: 0 0 12px 0;
  font-size: 1.25rem;
  color: var(--text-primary);
}
.method-card p {
  margin: 0;
  color: var(--text-secondary);
}

/* === СТИЛИ ТАБЛИЦ === */
.article-content-preview table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 0.95rem;
  line-height: 1.5;
}

.article-content-preview th,
.article-content-preview td {
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  text-align: left;
}

.article-content-preview th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
}

.article-content-preview tbody tr:nth-child(even) {
  background: var(--bg-secondary);
}

.article-content-preview tbody tr:hover {
  background: rgba(79, 70, 229, 0.05);
}

/* === ИКОНКИ В ТАБЛИЦАХ (✅ ❌ ⚠️) === */
.article-content-preview .icon-check,
.article-content-preview .icon-cross,
.article-content-preview .icon-warning {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.8rem;
  margin-right: 8px;
  flex-shrink: 0;
}
.article-content-preview .icon-check {
  background: #dcfce7;
  color: #16a34a;
}
.article-content-preview .icon-cross {
  background: #fee2e2;
  color: #dc2626;
}
.article-content-preview .icon-warning {
  background: #fef9c3;
  color: #92400e;
}

/* === ЗЕБРА + ОТСТУПЫ === */
.article-content-preview table th:first-child,
.article-content-preview table td:first-child {
  padding-left: 20px;
}
.article-content-preview table th:last-child,
.article-content-preview table td:last-child {
  padding-right: 20px;
}

/* === МОБИЛЬНАЯ АДАПТАЦИЯ === */
@media (max-width: 600px) {
  .article-content-preview table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .article-content-preview table th,
  .article-content-preview table td {
    min-width: 120px;
  }
}

/* =============================================
   СТРАНИЦА НОВОЙ СТАТЬИ — new_article.html
   ============================================= */

/* Нумерованные шаги */
.step-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-color);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  line-height: 1;
}
.step-text {
  font-weight: 500;
  font-size: 14px;
  color: var(--text-primary);
}

/* Разделитель между шагами */
.section-divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 14px 0;
}

/* Стрелка между двумя dropdown */
.model-select-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  color: var(--text-secondary);
  font-size: 16px;
  flex-shrink: 0;
  user-select: none;
}

/* Кнопка Сгенерировать — на всю ширину */
.btn-generate {
  width: 100%;
  padding: 14px 24px;
  margin-top: 8px;
  background: var(--accent-color);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
  letter-spacing: 0.2px;
}
.btn-generate:hover { opacity: 0.88; }

/* Кнопка Wordstat — как ссылка, без рамки */
.btn-wordstat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  padding: 0 !important;
  background: transparent !important;
  color: var(--text-secondary);
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  opacity: 1;
  transition: color 0.15s;
}
.btn-wordstat:hover {
  color: var(--accent-color);
  background: transparent !important;
  opacity: 1;
}

/* Заголовок блока предложенных тем */
.suggestions-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}
.suggestions-header-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-color);
  flex-shrink: 0;
}

/* Теги-пилюли */
.suggestions-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.suggestion-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-primary) !important;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  font-weight: 400;
  opacity: 1;
  white-space: nowrap;
}
.suggestion-pill:hover {
  background: var(--accent-color) !important;
  border-color: var(--accent-color) !important;
  color: #fff !important;
  opacity: 1;
}