/* === СБРОС И ПЕРЕМЕННЫЕ === */
:root {
    --primary-color: #0b2d4b;
    --secondary-color: #375e7f;
    --accent-color: #d45a2e;
    --bg-color: #f2f5f9;
    --paper-bg: #ffffff;
    --text-color: #1a2a3a;
    --text-muted: #4d6374;
    --border-color: #e0e8f0;
    --sidebar-width: 280px;
    --max-width: 1100px;
    --shadow: 0 25px 50px -12px rgba(0,0,0,0.08);
    --radius: 32px;
    --radius-sm: 12px;
    --transition: 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100vw;
}

/* === LAYOUT === */
.page-wrapper {
    display: flex;
    min-height: 100vh;
}

/* === SIDEBAR === */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--primary-color);
    padding: 1.5rem;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.logo {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.1);
    text-align: center;
}

.nav-list {
    list-style: none;
}

.nav-section {
    color: rgba(255,255,255,0.5);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.5rem;
    margin-top: 1rem;
    padding: 0 0.5rem;
}

.nav-section ul {
    list-style: none;
    margin-top: 0.5rem;
}

.nav-section li {
    margin-bottom: 0.25rem;
}

.nav-section a {
    display: block;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    transition: var(--transition);
}

.nav-section a:hover,
.nav-section a.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

/* === BURGER MENU === */
.burger {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 200;
    width: 44px;
    height: 44px;
    background: var(--primary-color);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    padding: 10px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.burger span {
    display: block;
    width: 24px;
    height: 2px;
    background: #fff;
    transition: var(--transition);
    border-radius: 2px;
}

.burger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.burger.active span:nth-child(2) {
    opacity: 0;
}

.burger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* === MAIN CONTENT === */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 2rem;
    min-height: 100vh;
}

.paper {
    max-width: var(--max-width);
    margin: 0 auto;
    background-color: var(--paper-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.5rem;
}

/* === TYPOGRAPHY === */
h1 {
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
    border-left: 8px solid var(--accent-color);
    padding-left: 1.3rem;
}

.subhead {
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--secondary-color);
    margin-top: 0.2rem;
    margin-bottom: 1.8rem;
    padding-left: 2rem;
}

h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--secondary-color);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

p {
    margin-bottom: 1rem;
    font-size: 1rem;
}

ul, ol {
    margin-left: 1.8rem;
    margin-bottom: 1rem;
}

li {
    margin-bottom: 0.5rem;
}

strong {
    font-weight: 600;
}

hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2rem 0;
}

/* === SPECIAL BOXES === */
.attention, .example-box, .strategy {
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    margin: 1.5rem 0;
}

.attention {
    background-color: #fff3e0;
    border-left: 4px solid #ff9800;
}

.attention p {
    margin-bottom: 0;
}

.example-box {
    background-color: #e8f5e9;
    border-left: 4px solid #4caf50;
}

.example-box p {
    margin-bottom: 0;
}

.strategy {
    background-color: #e3f2fd;
    border-left: 4px solid #2196f3;
}

.strategy p {
    margin-bottom: 0.75rem;
}

/* === TABLES === */
.scroll-table {
    overflow-x: auto;
    margin: 1.5rem 0;
    border-radius: var(--radius-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: var(--primary-color);
    color: #fff;
    font-weight: 600;
}

tr:hover {
    background: rgba(0,0,0,0.02);
}

/* === BADGE === */
.badge {
    display: inline-block;
    background: var(--accent-color);
    color: #fff;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 0.5rem;
}

/* === CALC === */
.calc {
    display: inline-block;
    background: rgba(0,0,0,0.05);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-family: 'Consolas', monospace;
    font-size: 0.9rem;
}

/* === CROSS-LINKING === */
.related-articles {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

.related-articles h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-size: 1.25rem;
}

.related-list {
    list-style: none;
    margin-left: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.related-list li {
    margin-bottom: 0;
}

.related-list a {
    display: block;
    padding: 1rem;
    background: var(--bg-color);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-color);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.related-list a:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* === PAGINATION === */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.pagination a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--bg-color);
    color: var(--text-color);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: var(--transition);
}

.pagination a:hover {
    background: var(--primary-color);
    color: #fff;
}

.pagination .prev::before {
    content: "←";
}

.pagination .next::after {
    content: "→";
}

.pagination .empty {
    visibility: hidden;
}

/* === FOOTER === */
.article-footer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.article-footer p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 0;
    }

    .burger {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition);
        width: 280px;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 5rem 1rem 1.5rem;
        max-width: 100%;
        overflow-x: hidden;
    }

    .paper {
        padding: 1.5rem;
        border-radius: 20px;
        overflow-x: hidden;
        max-width: 100%;
    }

    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        min-width: 0;
        max-width: 100%;
    }

    table tbody,
    table thead,
    table tr,
    table td,
    table th {
        display: block;
        width: 100%;
    }

    table thead {
        display: none;
    }

    table tr {
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 0.5rem;
    }

    table td {
        padding: 0.5rem;
        text-align: left;
        border-bottom: 1px solid var(--border-color);
    }

    table td:last-child {
        border-bottom: none;
    }

    table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--secondary-color);
        display: block;
        margin-bottom: 0.25rem;
    }

    img {
        max-width: 100%;
        height: auto;
    }

    /* Убираем фиксированные ширины */
    .paper * {
        max-width: 100%;
    }

    h1 {
        font-size: 1.75rem;
        padding-left: 1rem;
    }

    .subhead {
        font-size: 1.1rem;
        padding-left: 1rem;
    }

    h2 {
        font-size: 1.4rem;
    }

    h3 {
        font-size: 1.15rem;
    }

    .pagination {
        flex-direction: column;
        gap: 1rem;
    }

    .pagination a {
        width: 100%;
        justify-content: center;
    }
}

/* === OVERLAY FOR MOBILE === */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 50;
}

.overlay.active {
    display: block;
}

/* === INDEX PAGE === */
.hero {
    text-align: center;
    padding: 2rem 0 3rem;
}

.hero h1 {
    border-left: none;
    padding-left: 0;
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

.sections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.section-card {
    background: var(--bg-color);
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.section-card:hover {
    border-color: var(--accent-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.section-card h2 {
    margin-top: 0;
    font-size: 1.25rem;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.section-card ul {
    list-style: none;
    margin-left: 0;
}

.section-card li {
    margin-bottom: 0.5rem;
}

.section-card a {
    color: var(--text-color);
    text-decoration: none;
    display: block;
    padding: 0.4rem 0;
    transition: var(--transition);
}

.section-card a:hover {
    color: var(--accent-color);
    padding-left: 0.5rem;
}

/* === БЛОКИ ВЫДЕЛЕНИЯ === */

/* Важный блок (оранжевый) - для "Важно", "Внимание", "Важный нюанс" */
.warning-block {
    background-color: #fff7f0;
    border-left: 6px solid #d45a2e;
    padding: 1.3rem 2rem;
    border-radius: 24px;
    margin: 2rem 0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.02);
}

.warning-block p {
    margin: 0;
    line-height: 1.7;
}

.warning-block p + p {
    margin-top: 0.8rem;
}

/* Информационный блок (голубой) - для "Важный нюанс", примечаний */
.info-block {
    background-color: #eaf3fa;
    border-left: 6px solid #2b6f9e;
    padding: 1.3rem 2rem;
    border-radius: 24px;
    margin: 2rem 0;
}

.info-block p {
    margin: 0;
    line-height: 1.7;
}

.info-block p + p {
    margin-top: 0.8rem;
}

/* Исключения (зелёный) */
.exception-block {
    background-color: #f0f5e8;
    border-left: 6px solid #3b7a4b;
    padding: 1.3rem 2rem;
    border-radius: 24px;
    margin: 2rem 0;
}

/* Блок с вопросом (для ситуаций/кейсов) */
.case-block {
    background-color: #f8fbfd;
    border: 1px solid #cbdde9;
    border-radius: 24px;
    padding: 1.5rem 2rem;
    margin: 1.8rem 0;
}

.case-block p {
    margin: 0;
    line-height: 1.7;
}

.case-block p + p {
    margin-top: 0.8rem;
}

/* Стили для strong в блоках */
.warning-block strong,
.info-block strong,
.exception-block strong,
.case-block strong {
    color: #1a2a3a;
}

/* Стили для italic в блоках */
.warning-block em,
.info-block em {
    font-style: normal;
    background-color: rgba(0,0,0,0.05);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

/* Адаптив для блоков */
@media (max-width: 768px) {
    .warning-block,
    .info-block,
    .exception-block,
    .case-block {
        padding: 1rem 1.2rem;
        border-radius: 16px;
    }
}
