/* _static/custom.css */
body {
    font-family: Arial, sans-serif;
    color: #333;
}

.wy-nav-content {
    max-width: 100%;
}
td {
  /* text-align: center; */
  height: auto;
}
th:nth-child(3) {text-align:center;}
td:nth-child(3) {text-align:center;}
table {
  width: auto;
}

/* unvisited link */
a:link {
  color: rgb(0, 140, 255);
}

/* visited link */
a:visited {
  color: rgb(0, 140, 255);
}

/* mouse over link */
a:hover {
  color: hotpink;
}

/* selected link */
a:active {
  color: blue;
}

/* Стили только для таблиц с классом fixed-width-table */
table.fixed-width-table {
    table-layout: fixed !important;
    width: 100% !important;
}

table.fixed-width-table td:first-child,
table.fixed-width-table th:first-child {
    width: 40% !important;
    min-width: 40% !important;
    max-width: 40% !important;
}

table.fixed-width-table td:nth-child(2),
table.fixed-width-table th:nth-child(2) {
    width: 60% !important;
    min-width: 60% !important;
    max-width: 60% !important;
}

/* Перенос текста */
table.fixed-width-table td {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ============================================
   CUSTOM.CSS - Настройки таблиц для Sphinx
   Требования:
   1. Таблица прижата влево
   2. Ширина столбцов для всех таблиц одинаковая
   3. Защита от изменения шрифтов
   4. Возможность задания разных значений ширины
   ============================================ */

/* ===== ОСНОВНОЙ КЛАСС ДЛЯ ВСЕХ ТАБЛИЦ ===== */

/* Базовые стили для всех UI таблиц */
.table-ui {
    /* 1. ПРИЖАТИЕ ВЛЕВО */
    margin: 1.5rem 0 1.5rem 0 !important;
    margin-left: 0 !important;
    margin-right: auto !important;
    float: none !important;
    text-align: left !important;
    
    /* 2. ОДИНАКОВАЯ ШИРИНА ТАБЛИЦ */
    width: clamp(20rem, 95%, 53.125rem) !important; /* 320-850px */
    max-width: 53.125rem !important; /* 850px максимум */
    
    /* 3. ЗАЩИТА ОТ ИЗМЕНЕНИЯ ШРИФТОВ */
    table-layout: fixed !important;
    border-collapse: collapse !important;
    font-size: inherit !important;
    line-height: inherit !important;
    
    /* Внешний вид */
    border: 1px solid #dee2e6;
    background-color: #fff;
}

/* Ячейки таблицы */
.table-ui td {
    /* 3. ЗАЩИТА ОТ ИЗМЕНЕНИЯ ШРИФТОВ */
    padding: 0.75em 1em !important; /* em вместо px */
    box-sizing: border-box !important;
    vertical-align: top !important;
    
    /* Защита от переполнения текста */
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    hyphens: auto !important;
    
    border: 1px solid #dee2e6;
}

/* Первая строка таблицы */
.table-ui tr:first-child td:first-child {
    background-color: #f8f9fa;
    font-weight: 600;
}

/* Последняя строка (описание) */
.table-ui tr:last-child td {
    width: 100% !important;
    background-color: #f0f8ff !important;
    border-top: 2px solid #cce7ff !important;
    font-style: italic;
    color: #0c5460;
}

/* ===== СТАНДАРТНЫЕ РАЗМЕРЫ КОЛОНОК (40%/60%) ===== */

/* 2. ОДИНАКОВАЯ ШИРИНА СТОЛБЦОВ ПО УМОЛЧАНИЮ */
.table-ui.cols-default td:first-child,
.table-ui:not([class*="cols-"]) td:first-child {
    /* 3. АДАПТИВНАЯ ШИРИНА С ЗАЩИТОЙ */
    width: clamp(12rem, 40%, 21.25rem) !important; /* 192-340px */
    min-width: 12rem !important;
    max-width: 21.25rem !important;
}

.table-ui.cols-default td:last-child,
.table-ui:not([class*="cols-"]) td:last-child {
    width: clamp(18rem, 60%, 31.875rem) !important; /* 288-510px */
    min-width: 18rem !important;
    max-width: 31.875rem !important;
}

/* ===== 4. ВАРИАНТЫ ДРУГИХ РАЗМЕРОВ КОЛОНОК ===== */

/* Вариант 1: 30%/70% (узкая левая колонка) */
.table-ui.cols-30-70 td:first-child {
    width: clamp(10rem, 30%, 15.9375rem) !important; /* 160-255px */
    min-width: 10rem !important;
    max-width: 15.9375rem !important;
}

.table-ui.cols-30-70 td:last-child {
    width: clamp(20rem, 70%, 37.1875rem) !important; /* 320-595px */
    min-width: 20rem !important;
    max-width: 37.1875rem !important;
}

/* Вариант 2: 25%/75% (очень узкая левая колонка) */
.table-ui.cols-25-75 td:first-child {
    width: clamp(8rem, 25%, 12.5rem) !important; /* 128-200px */
    min-width: 8rem !important;
    max-width: 12.5rem !important;
}

.table-ui.cols-25-75 td:last-child {
    width: clamp(22rem, 75%, 40.625rem) !important; /* 352-650px */
    min-width: 22rem !important;
    max-width: 40.625rem !important;
}

/* Вариант 3: 50%/50% (равные колонки) */
.table-ui.cols-50-50 td:first-child {
    width: clamp(12rem, 50%, 26.5625rem) !important; /* 192-425px */
    min-width: 12rem !important;
    max-width: 26.5625rem !important;
}

.table-ui.cols-50-50 td:last-child {
    width: clamp(12rem, 50%, 26.5625rem) !important; /* 192-425px */
    min-width: 12rem !important;
    max-width: 26.5625rem !important;
}

/* Вариант 4: 20%/80% (минимальная левая колонка) */
.table-ui.cols-20-80 td:first-child {
    width: clamp(6rem, 20%, 10rem) !important; /* 96-160px */
    min-width: 6rem !important;
    max-width: 10rem !important;
}

.table-ui.cols-20-80 td:last-child {
    width: clamp(24rem, 80%, 43.125rem) !important; /* 384-690px */
    min-width: 24rem !important;
    max-width: 43.125rem !important;
}

/* Вариант 5: 65%/35% (широкая левая колонка) */
.table-ui.cols-65-35 td:first-child {
    width: clamp(18rem, 65%, 34.5625rem) !important; /* 288-553px */
    min-width: 18rem !important;
    max-width: 34.5625rem !important;
}

.table-ui.cols-65-35 td:last-child {
    width: clamp(10rem, 35%, 18.59375rem) !important; /* 160-297.5px */
    min-width: 10rem !important;
    max-width: 18.59375rem !important;
}

/* ===== МЕДИА-ЗАПРОСЫ ДЛЯ ЗАЩИТЫ ОТ ШРИФТОВ ===== */

/* Для больших экранов - фиксированные размеры */
@media (min-width: 1200px) {
    .table-ui.cols-default td:first-child { width: 21.25rem !important; } /* 340px */
    .table-ui.cols-default td:last-child { width: 31.875rem !important; } /* 510px */
    
    .table-ui.cols-30-70 td:first-child { width: 15.9375rem !important; } /* 255px */
    .table-ui.cols-30-70 td:last-child { width: 37.1875rem !important; } /* 595px */
    
    .table-ui.cols-25-75 td:first-child { width: 12.5rem !important; } /* 200px */
    .table-ui.cols-25-75 td:last-child { width: 40.625rem !important; } /* 650px */
    
    .table-ui.cols-50-50 td:first-child,
    .table-ui.cols-50-50 td:last-child { width: 26.5625rem !important; } /* 425px */
    
    .table-ui.cols-20-80 td:first-child { width: 10rem !important; } /* 160px */
    .table-ui.cols-20-80 td:last-child { width: 43.125rem !important; } /* 690px */
    
    .table-ui.cols-65-35 td:first-child { width: 34.5625rem !important; } /* 553px */
    .table-ui.cols-65-35 td:last-child { width: 18.59375rem !important; } /* 297.5px */
}

/* Для мобильных устройств */
@media (max-width: 768px) {
    .table-ui {
        width: 100% !important;
        max-width: 100% !important;
        display: block;
        overflow-x: auto;
    }
    
    .table-ui td {
        min-width: 45vw !important; /* Минимум 45% ширины экрана */
        font-size: 0.95em !important;
    }
}

/* При очень больших шрифтах */
@media (min-resolution: 192dpi) {
    .table-ui {
        border-width: 0.5px !important;
    }
    
    .table-ui td {
        padding: 1em 1.25em !important;
        line-height: 1.6 !important;
    }
}

/* Для печати */
@media print {
    .table-ui {
        width: 100% !important;
        max-width: 100% !important;
        font-size: 10pt !important;
        break-inside: avoid;
        margin: 0.5cm 0 !important;
    }
    
    .table-ui td {
        padding: 1mm 2mm !important;
        overflow-wrap: normal !important;
        word-break: normal !important;
        hyphens: manual !important;
        border-color: #000 !important;
    }
    
    .table-ui tr:first-child td:first-child {
        background-color: #eee !important;
    }
    
    .table-ui tr:last-child td {
        background-color: #e6f7ff !important;
    }
}

/* ===== ГАРАНТИЯ ПРИЖАТИЯ ВЛЕВО ===== */

/* Перебиваем возможные стили центрирования от Sphinx */
.docutils.table-ui,
.wy-table-responsive .table-ui,
.rst-content .table-ui,
section .table-ui,
body .table-ui {
    margin-left: 0 !important;
    margin-right: auto !important;
}

/* Контейнер для дополнительного контроля */
.table-container {
    text-align: left !important;
    margin: 1.5rem 0 !important;
}

.table-container .table-ui {
    margin: 0 !important;
}

/* ===== УТИЛИТЫ ===== */

/* Для отладки */
.table-ui.debug {
    outline: 2px solid red !important;
}

.table-ui.debug td:first-child {
    outline: 2px solid blue !important;
}

.table-ui.debug td:last-child {
    outline: 2px solid green !important;
}

/* Альтернативный стиль */
.table-ui.style-alt tr:first-child td:first-child {
    background-color: #e8f4fd;
    border-right: 2px solid #3498db;
}

.table-ui.style-alt tr:last-child td {
    background-color: #f9f9f9;
    border-top: 2px solid #95a5a6;
    color: #2c3e50;
}

/* ===== СОВМЕСТИМОСТЬ С СУЩЕСТВУЮЩИМИ ТАБЛИЦАМИ ===== */

/* Если нужно переопределить старые классы */
.robust-table {
    composes: table-ui cols-default; /* Совместимость */
}

.table-screenshot {
    display: block;
    margin: 1em auto;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-width: 100%;
    height: auto;
}

table.left-align-table td:nth-child(3),
table.left-align-table th:nth-child(3) {
    text-align: left !important;
}