/* style.css - Главный файл стилей для энциклопедии */

/* ---- Глобальные стили ---- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary-color: #3b82f6;
    --bg-color: #f8fafc;
    --bg-white: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #1e293b;
    --text-muted: #475569;
    --text-light: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.08);
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --transition: 0.2s ease;
    --max-width: 960px;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
    font-family: var(--font-family);
    line-height: 1.8;
    color: var(--text-secondary);
    max-width: var(--max-width);
    margin: 40px auto;
    padding: 20px 30px;
    background-color: var(--bg-color);
}

/* ---- Заголовки ---- */
h1 {
    font-size: 2.6rem;
    color: var(--text-primary);
    border-bottom: 3px solid var(--secondary-color);
    padding-bottom: 10px;
    margin-top: 0;
    text-align: center;
}

h1 .emoji {
    margin-right: 10px;
}

h2 {
    font-size: 1.7rem;
    color: var(--text-secondary);
    margin-top: 40px;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 6px;
}

h3 {
    font-size: 1.3rem;
    color: #334155;
    margin-top: 28px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 4px;
}

h4 {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-top: 20px;
    margin-bottom: 8px;
}

/* ---- Навигация ---- */
.chapter-nav {
    background: var(--bg-white);
    padding: 12px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin: 20px 0;
    font-size: 0.95rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.chapter-nav .nav-left,
.chapter-nav .nav-right {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.chapter-nav a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

.chapter-nav a:hover {
    text-decoration: underline;
}

.nav-sep {
    color: #94a3b8;
}

/* ---- Оглавление (TOC) ---- */
.toc {
    background: var(--bg-white);
    padding: 20px 30px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 40px;
    border-left: 4px solid var(--secondary-color);
}

.toc h2 {
    margin-top: 0;
    color: var(--text-primary);
    font-size: 1.3rem;
    border-bottom: none;
}

.toc ul {
    padding-left: 20px;
}

.toc li {
    margin: 6px 0;
}

.toc a {
    color: var(--primary-color);
    text-decoration: none;
}

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

/* ---- Аннотация ---- */
.annotation-box {
    background: #f1f5f9;
    border-left: 4px solid var(--secondary-color);
    padding: 14px 20px;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    margin: 20px 0 30px 0;
    color: var(--text-secondary);
}

.annotation-box strong {
    color: var(--text-primary);
}

/* ---- Карточка тома ---- */
.tom-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 20px 24px;
    margin: 20px 0;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}

.tom-card:hover {
    box-shadow: var(--shadow-lg);
}

.tom-card .tom-number {
    font-size: 0.85rem;
    color: var(--secondary-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tom-card .tom-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 4px 0 6px 0;
}

.tom-card .tom-title a {
    color: var(--text-primary);
    text-decoration: none;
}

.tom-card .tom-title a:hover {
    color: var(--primary-color);
}

.tom-card .tom-desc {
    color: var(--text-muted);
    margin-bottom: 12px;
}

.tom-card .tom-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 20px;
    margin-top: 8px;
}

.tom-card .tom-sections a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.95rem;
}

.tom-card .tom-sections a:hover {
    text-decoration: underline;
}

.tom-card .tom-sections .section-item {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.tom-card .tom-sections .section-num {
    color: #94a3b8;
    font-size: 0.8rem;
    min-width: 20px;
}

/* ---- Цитаты из форума ---- */
.forum-quote {
    background: #f1f5f9;
    border-left: 4px solid #64748b;
    padding: 12px 18px;
    margin: 20px 0;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    font-style: italic;
    color: var(--text-secondary);
}

.forum-quote strong {
    color: var(--text-primary);
    font-style: normal;
}

.forum-link {
    font-size: 0.85rem;
    color: var(--primary-color);
    text-decoration: none;
    font-style: normal;
    background: var(--primary-light);
    padding: 1px 6px;
    border-radius: 4px;
}

.forum-link:hover {
    text-decoration: underline;
    background: #bfdbfe;
}

/* ---- Таблицы ---- */
.table-wrap {
    overflow-x: auto;
    margin: 24px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    font-size: 0.95rem;
}

th {
    background: var(--border-color);
    font-weight: 600;
    text-align: left;
    padding: 10px 14px;
    border-bottom: 2px solid #cbd5e1;
}

td {
    padding: 8px 14px;
    border-bottom: 1px solid var(--border-color);
}

tr:last-child td {
    border-bottom: none;
}

/* ---- Блок "Смотри также" ---- */
.see-also {
    background: #f0f9ff;
    border-left: 4px solid var(--secondary-color);
    padding: 12px 18px;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    margin: 24px 0;
}

.see-also a {
    color: var(--primary-color);
    text-decoration: none;
}

.see-also a:hover {
    text-decoration: underline;
}

/* ---- Мета-заметка (жёлтая) ---- */
.meta-note {
    background: #fef9c3;
    padding: 10px 16px;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    color: #854d0e;
    border-left: 4px solid #eab308;
    margin: 24px 0;
}

/* ---- Список ключевых пунктов ---- */
.key-points {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px 24px;
    margin: 24px 0;
}

.key-points li {
    margin-bottom: 8px;
}

.key-points strong {
    color: var(--text-primary);
}

/* ---- Блок "Итоги" ---- */
.conclusion-box {
    background: #f0f9ff;
    border-left: 4px solid var(--secondary-color);
    padding: 16px 22px;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    margin: 30px 0;
}

.conclusion-box ul {
    padding-left: 20px;
}

.conclusion-box li {
    margin-bottom: 6px;
}

.conclusion-box strong {
    color: var(--text-primary);
}

/* ---- Карточки для ключевых пунктов ---- */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.summary-card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    padding: 16px 20px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.summary-card h4 {
    margin: 0 0 4px 0;
    color: var(--text-primary);
}

.summary-card .price {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--secondary-color);
}

.summary-card .tag {
    font-size: 0.75rem;
    background: #f1f5f9;
    padding: 1px 10px;
    border-radius: 12px;
    display: inline-block;
    margin-top: 4px;
}

/* ---- Цветные метки ---- */
.best-choice {
    background: #dcfce7;
    color: #16a34a;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
}

.worst-choice {
    background: #fee2e2;
    color: #dc2626;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
}

.neutral-choice {
    background: #f1f5f9;
    color: #64748b;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
}

/* ---- Статистика ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin: 24px 0;
}

.stat-item {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 14px 18px;
    text-align: center;
}

.stat-item .stat-number {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-item .stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* ---- Разделитель ---- */
hr {
    border: none;
    border-top: 2px dashed #cbd5e1;
    margin: 40px 0;
}

/* ---- Мета-информация (футер) ---- */
.meta-info {
    color: #94a3b8;
    font-size: 0.85rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    margin-top: 30px;
}

.meta-info a {
    color: var(--primary-color);
    text-decoration: none;
}

.meta-info a:hover {
    text-decoration: underline;
}

/* ---- Вспомогательные классы ---- */
.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.hidden {
    display: none;
}

/* ---- Поиск ---- */
.search-container {
    margin: 20px 0;
}

.search-container form {
    display: flex;
    gap: 10px;
}

.search-container input[type="text"] {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: var(--font-family);
}

.search-container input[type="text"]:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-container button {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    font-family: var(--font-family);
    transition: background var(--transition);
}

.search-container button:hover {
    background: var(--primary-dark);
}

/* ---- Адаптивность для мобильных ---- */
@media (max-width: 640px) {
    .tom-card .tom-sections {
        grid-template-columns: 1fr;
    }

    body {
        padding: 12px 16px;
        margin: 20px auto;
    }

    h1 {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.3rem;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .search-container form {
        flex-direction: column;
    }

    .chapter-nav {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .chapter-nav .nav-left,
    .chapter-nav .nav-right {
        justify-content: center;
    }

    .summary-grid {
        grid-template-columns: 1fr 1fr;
    }
}