/* Основные стили для статей */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Times New Roman', Times, serif;
    font-size: 14pt;
    line-height: 1.5;
    color: #000000;
    background: #ffffff;
    padding: 20px;
}

/* Контейнер статьи */
.article-container {
    max-width: 210mm;
    margin: 0 auto;
    padding: 25mm;
    background: white;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    min-height: 297mm;
}

/* Заголовок статьи */
.article-title {
    text-align: center;
    font-weight: bold;
    font-size: 16pt;
    text-transform: uppercase;
    margin-bottom: 15px;
    line-height: 1.2;
}

/* УДК */
.article-udc {
    text-align: right;
    font-style: italic;
    font-size: 10pt;
    margin-bottom: 20px;
    color: #666666;
}

/* Авторы */
.article-authors {
    text-align: center;
    font-size: 12pt;
    margin-bottom: 25px;
    line-height: 1.3;
}

.article-authors em {
    font-style: italic;
    font-size: 11pt;
}

/* Аннотация */
.article-abstract {
    background: #f8f8f8;
    border-left: 3px solid #000000;
    padding: 15px;
    margin: 20px 0;
    font-style: italic;
    text-align: justify;
    font-size: 12pt;
}

/* Ключевые слова */
.article-keywords {
    margin: 15px 0 25px 0;
    font-weight: bold;
    font-size: 12pt;
}

/* Основной текст */
.article-text {
    text-align: justify;
    text-indent: 1.5em;
    margin-bottom: 12pt;
    line-height: 1.5;
}

/* Разделы */
.article-section {
    font-weight: bold;
    text-align: center;
    margin: 25px 0 15px 0;
    font-size: 14pt;
    text-transform: uppercase;
}

/* Формулы */
.article-formula {
    text-align: center;
    margin: 20px 0;
    font-style: italic;
    font-family: 'Times New Roman', Times, serif;
    font-size: 14pt;
}

.article-formula sub {
    font-size: 10pt;
    vertical-align: sub;
}

/* Изображения */
.article-image {
    text-align: center;
    margin: 25px 0;
}

.image-placeholder {
    background: #f0f0f0;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #cccccc;
    margin: 0 auto;
    max-width: 80%;
}

.image-placeholder span {
    color: #666666;
    font-style: italic;
}

.article-image-caption {
    font-style: italic;
    margin-top: 8px;
    font-size: 12pt;
    text-align: center;
    color: #666666;
}

/* Список литературы */
.article-references {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #cccccc;
}

.article-reference-item {
    text-align: justify;
    margin-bottom: 10px;
    font-size: 12pt;
    line-height: 1.4;
    text-indent: -1.5em;
    padding-left: 1.5em;
}

/* Ссылка назад */
.article-back-link {
    display: inline-block;
    margin-top: 25px;
    color: #0000cc;
    text-decoration: none;
    font-weight: bold;
    font-size: 12pt;
}

.article-back-link:hover {
    text-decoration: underline;
    color: #000099;
}

/* Заголовки внутри текста */
.article-subsection {
    font-weight: bold;
    margin: 15px 0 10px 0;
    text-align: left;
    font-size: 14pt;
}

/* Нумерация формул */
.article-formula-number {
    font-style: normal;
    font-weight: normal;
    margin-left: 10px;
}

/* Стили для таблиц */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 12pt;
    page-break-inside: avoid;
}

table caption {
    font-weight: bold;
    text-align: center;
    margin-bottom: 10px;
    font-size: 12pt;
    color: #000000;
}

table thead {
    background-color: #f2f2f2;
    border-top: 2px solid #000000;
    border-bottom: 2px solid #000000;
}

table th {
    font-weight: bold;
    text-align: center;
    padding: 8px 12px;
    border: 1px solid #cccccc;
    vertical-align: middle;
    font-size: 12pt;
}

table td {
    padding: 8px 12px;
    border: 1px solid #cccccc;
    text-align: left;
    vertical-align: top;
    font-size: 12pt;
}

table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

table tbody tr:hover {
    background-color: #f5f5f5;
}

/* Компактные таблицы */
table.compact-table {
    font-size: 11pt;
}

table.compact-table th,
table.compact-table td {
    padding: 6px 8px;
}

/* Таблицы с выравниванием по центру */
table.center-table th,
table.center-table td {
    text-align: center;
}

/* Таблицы без границ */
table.no-border,
table.no-border th,
table.no-border td {
    border: none;
}

table.no-border th {
    border-bottom: 1px solid #cccccc;
}

/* Для печати */
@media print {
    body {
        padding: 0;
        margin: 0;
    }
    
    .article-container {
        box-shadow: none;
        padding: 20mm;
        min-height: auto;
    }
    
    .article-back-link {
        display: none;
    }
    
    .image-placeholder {
        background: none;
        border: 1px solid #000000;
    }
    
    table {
        border: 1px solid #000000;
    }
    
    table th,
    table td {
        border: 1px solid #000000;
    }
    
    table thead {
        background-color: #e0e0e0;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    table tbody tr:nth-child(even) {
        background-color: #f0f0f0;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* Адаптивность */
@media (max-width: 768px) {
    body {
        padding: 10px;
        font-size: 12pt;
    }
    
    .article-container {
        padding: 15px;
        min-height: auto;
    }
    
    .article-title {
        font-size: 14pt;
    }
    
    .article-text {
        font-size: 12pt;
    }
    
    .image-placeholder {
        height: 150px;
        max-width: 95%;
    }
    
    table {
        font-size: 10pt;
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    table th,
    table td {
        padding: 6px 8px;
    }
}

/* Стили для специальных элементов */
.article-note {
    background: #ffffcc;
    border-left: 3px solid #ffcc00;
    padding: 10px;
    margin: 15px 0;
    font-style: italic;
}

.article-important {
    background: #ffe6e6;
    border-left: 3px solid #cc0000;
    padding: 10px;
    margin: 15px 0;
    font-weight: bold;
}

/* Выравнивание по ширине */
.text-justify {
    text-align: justify;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

/* Отступы */
.margin-top-20 {
    margin-top: 20px;
}

.margin-bottom-20 {
    margin-bottom: 20px;
}

.margin-left-20 {
    margin-left: 20px;
}

.margin-right-20 {
    margin-right: 20px;
}

/* Жирный и курсив */
.bold {
    font-weight: bold;
}

.italic {
    font-style: italic;
}

.underline {
    text-decoration: underline;
}

/* Заглушки для изображений */
.image-placeholder img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.article-reference-item {
    text-align: justify;
    margin-bottom: 10px;
    font-size: 12pt;
    line-height: 1.4;
    text-indent: -1.5em;
    padding-left: 2.5em;
}

/* Дополнительные классы для таблиц */
.table-wrapper {
    overflow-x: auto;
    margin: 20px 0;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Стили для ячеек с цифрами */
.number-cell {
    text-align: right;
    font-family: 'Courier New', monospace;
}

/* Стили для заголовков таблиц в основном тексте */
.article-text table {
    margin: 15px 0;
}

.article-text table caption {
    margin-bottom: 8px;
    font-style: italic;
}

/* Добавьте эти стили в ваш article.css */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 15px 0;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.table-responsive table {
    margin: 0;
    min-width: 800px; /* Минимальная ширина для больших таблиц */
}

.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Для печати */
@media print {
    .table-responsive {
        overflow-x: visible;
        border: none;
    }
    
    .table-responsive table {
        min-width: auto;
        width: 100%;
        page-break-inside: avoid;
    }
}

/* Стили для ссылок на литературу */
.ref-link {
    color: #3a4d70;
    text-decoration: none;
    font-weight: 600;
    background-color: rgba(58, 77, 112, 0.08);
    padding: 1px 4px;
    border-radius: 3px;
    margin: 0 1px;
    transition: all 0.2s ease;
    font-family: 'Times New Roman', Times, serif;
    font-size: 12pt;
}

.ref-link:hover {
    color: #ffffff;
    background-color: #3a4d70;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(58, 77, 112, 0.2);
}

.ref-link:active {
    transform: translateY(0);
}