/* Custom styles compatible with Bootstrap 4.3.1 */

/* ==========================================================================
   1. ГЛОБАЛЬНЫЕ ПЕРЕМЕННЫЕ И СБРОС СТИЛЕЙ
   ========================================================================== */

/* Определение кастомных цветов через CSS-переменные */
:root {
    --custom-primary: #2c3e50;      /* Основной темно-синий цвет */
    --custom-secondary: #4a6491;    /* Вторичный сине-серый цвет */
    --custom-light: #f5f7fa;        /* Светлый фоновый цвет */

    /* Дополнительные переменные для других файлов */
    --color-border: #ddd;
    --color-bg-alt: #f8f9fa;
    --color-text: #333;

    --border-radius-sm: 4px;
    --border-radius-md: 8px;

    --transition-bar: all 0.3s ease;
    --animation-bar-delay: 0.1s;
    --animation-bar-duration: 0.8s;
    --animation-bar-timing: ease;

    --bp-sm: 576px;
    --bp-md: 768px;
    --bp-lg: 992px;
}

/* Тестовый класс для проверки переменных */
.test-variables {
    color: var(--custom-primary, red);
    background: var(--custom-secondary, blue);
}

/* Сброс стандартных отступов и настройка box-sizing */
.custom-reset {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ==========================================================================
   2. ОСНОВНЫЕ СТИЛИ СТРАНИЦЫ
   ========================================================================== */

/* Стили для основного тела документа */
.custom-body {
    background-color: var(--custom-light);
    color: #333;
    line-height: 1.6;
    padding: 20px;
}

/* Обертка основного контента с центрированием и тенями */
.custom-container {
    max-width: 1000px;
    margin: 0 auto;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* ==========================================================================
   3. ШАПКА СТРАНИЦЫ
   ========================================================================== */

/* Стили для заголовочной секции */
.custom-header {
    background: linear-gradient(135deg, var(--custom-primary), var(--custom-secondary));
    color: white;
    padding: 30px 20px;
    text-align: center;
}

/* Заголовок первого уровня в шапке */
.custom-header h1 {
    font-size: 2.2rem;
    margin-bottom: 10px;
    font-weight: 300;
}

/* Подзаголовок в шапке */
.custom-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* ==========================================================================
   4. ОСНОВНОЙ КОНТЕНТ
   ========================================================================== */

/* Внутренние отступы основного контента */
.custom-content {
    padding: 30px;
}

/* Общий стиль для секций */
.custom-section {
    margin-bottom: 30px;
}

/* Заголовки секций */
.custom-section h2 {
    color: var(--custom-primary);
    border-bottom: 2px solid var(--custom-secondary);
    padding-bottom: 8px;
    margin-bottom: 15px;
    font-size: 1.5rem;
    font-weight: 400;
}

/* Обычный текстовый абзац */
.custom-text {
    margin-bottom: 15px;
    text-align: justify;
}

/* Выделение современных подходов */
.custom-modern-approaches {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--custom-secondary);
}

/* Элемент списка подходов */
.custom-approach-item {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px dashed #ddd;
    transition: transform 0.3s ease;
}

/* Эффект при наведении на элемент подхода */
.custom-approach-item:hover {
    transform: translateX(5px);
}

/* Последний элемент списка подходов */
.custom-approach-item:last-child {
    border-bottom: 1px solid #ddd;
    margin-bottom: 10px;
    padding-bottom: 15px;
}

/* Заголовок элемента подхода */
.custom-approach-item h3 {
    color: var(--custom-primary);
    margin-bottom: 8px;
    font-size: 1.2rem;
    font-weight: 500;
}

/* Примеры внутри элемента подхода */
.custom-examples {
    font-style: italic;
    color: #555;
    margin-top: 5px;
}

/* Контейнер для графика */
.custom-chart-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin: 20px 0;
    overflow-x: auto;
    justify-content: center;
    text-align: center;
}

/* Заголовок графика */
.custom-chart-title {
    text-align: center;
    margin-bottom: 10px;
    color: var(--custom-primary);
    font-weight: bold;
}

/* ==========================================================================
   5. ТАБЛИЦЫ
   ========================================================================== */

/* Стили для кастомной таблицы */
.custom-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

/* Ячейки таблицы */
.custom-table th,
.custom-table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

/* Заголовки таблицы */
.custom-table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

/* Зебра-стиль для четных строк */
.custom-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* ==========================================================================
   7. КНОПКИ И ССЫЛКИ
   ========================================================================== */

/* Основная кастомная кнопка */
.btn-custom-secondary {
    background: linear-gradient(135deg, var(--custom-secondary), #5d7cb0);
    color: white !important;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    display: inline-block;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Эффект при наведении на основную кнопку */
.btn-custom-secondary:hover {
    background: linear-gradient(135deg, #5d7cb0, var(--custom-secondary));
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    color: white;
    text-decoration: none;
}

/* Эффект при нажатии на основную кнопку */
.btn-custom-secondary:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Контурная кастомная кнопка */
.btn-custom-outline {
    background: transparent;
    color: var(--custom-secondary) !important;
    padding: 8px 18px;
    border: 2px solid var(--custom-secondary);
    border-radius: 5px;
    text-decoration: none;
    display: inline-block;
    font-weight: 500;
    transition: all 0.3s ease;
}

/* Эффект при наведении на контурную кнопку */
.btn-custom-outline:hover {
    background: var(--custom-secondary);
    color: white !important;
    text-decoration: none;
}

/* Обычная кастомная ссылка */
.custom-link {
    color: var(--custom-secondary);
    text-decoration: none;
    border-bottom: 1px dotted var(--custom-secondary);
    transition: all 0.3s ease;
}

/* Эффект при наведении на обычную ссылку */
.custom-link:hover {
    color: var(--custom-primary);
    border-bottom: 1px solid var(--custom-primary);
    text-decoration: none;
}

/* Ссылка на учебник */
.textbook-link {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 15px;
    background: var(--custom-light);
    border-radius: 5px;
    transition: all 0.3s ease;
}

/* Эффект при наведении на ссылку на учебник */
.textbook-link:hover {
    background: #e8ecef;
    transform: translateX(5px);
}

/* Контурная кастомная кнопка */
.btn-custom-outline {
    background: transparent;
    color: var(--custom-secondary) !important;
    padding: 8px 18px;
    border: 2px solid var(--custom-secondary);
    border-radius: 5px;
    text-decoration: none;
    display: inline-block;
    font-weight: 500;
    transition: all 0.3s ease;
}

/* ==========================================================================
   7.1. СПЛОШНАЯ КАСТОМНАЯ КНОПКА
   ========================================================================== */

/* Сплошная кастомная кнопка */
.btn-custom-solid {
    background: linear-gradient(135deg, var(--custom-primary), var(--custom-secondary));
    color: white !important;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    display: inline-block;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Эффект при наведении на сплошную кнопку */
.btn-custom-solid:hover {
    background: linear-gradient(135deg, var(--custom-secondary), var(--custom-primary));
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    color: white;
    text-decoration: none;
}

/* Эффект при нажатии на сплошную кнопку */
.btn-custom-solid:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* ==========================================================================
   8. ФОРМУЛЫ И ТЕКСТОВЫЕ ЭЛЕМЕНТЫ
   ========================================================================== */

/* Стили для формул */
.formula {
    text-align: center;
    margin: 15px 0;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
    font-family: "Times New Roman", serif;
    font-size: 1.1em;
}

/* Переменные в формулах */
.variable {
    font-style: italic;
}

.formula-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.formula-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #28a745;
}

.formula-item .formula {
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 8px;
    color: #dc3545;
}

.formula-item .formula-description {
    font-size: 0.9em;
    color: #6c757d;
}

/* ==========================================================================
   10. ПОДВАЛ СТРАНИЦЫ
   ========================================================================== */

/* Стили для футера */
.custom-footer {
    text-align: center;
    padding: 20px;
    background-color: var(--custom-primary);
    color: white;
    font-size: 0.9rem;
    position: relative;
}

/* Кнопка "Наверх" в футере */
.custom-back-to-top {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--custom-secondary), #5d7cb0);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1.2rem;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

/* Эффект при наведении на кнопку "Наверх" */
.custom-back-to-top:hover {
    background: linear-gradient(135deg, #5d7cb0, var(--custom-secondary));
    transform: translateX(-50%) translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
    color: white;
    text-decoration: none;
}

/* Эффект при нажатии на кнопку "Наверх" */
.custom-back-to-top:active {
    transform: translateX(-50%) translateY(0);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ==========================================================================
   11. КАСТОМНЫЕ КЛАССЫ ЦВЕТА
   ========================================================================== */

/* Классы для изменения цвета текста */
.text-custom-primary { color: var(--custom-primary) !important; }
.text-custom-secondary { color: var(--custom-secondary) !important; }

/* Классы для изменения цвета фона */
.bg-custom-primary { background-color: var(--custom-primary) !important; }
.bg-custom-secondary { background-color: var(--custom-secondary) !important; }

/* ==========================================================================
   12. АДАПТИВНЫЕ СТИЛИ (MEDIA QUERIES)
   ========================================================================== */

/* --- Для планшетов и больших мобильных устройств --- */
@media (max-width: 768px) {
    /* Адаптация заголовка */
    .custom-header h1 {
        font-size: 1.8rem;
    }
    
    /* Уменьшение внутренних отступов контента */
    .custom-content {
        padding: 15px;
    }

    /* Адаптация кнопок */
    .btn-custom-secondary,
    .btn-custom-outline {
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    /* Адаптация кнопки "Наверх" */
    .custom-back-to-top {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
        top: -22px;
    }
}

/* --- Для мобильных устройств --- */
@media (max-width: 480px) {
    /* Уменьшение отступов тела документа */
    .custom-body {
        padding: 10px;
    }
    
    /* Скругление углов контейнера */
    .custom-container {
        border-radius: 8px;
    }
    
    /* Адаптация шапки */
    .custom-header {
        padding: 20px 15px;
    }
    
    /* Уменьшение отступов контента */
    .custom-content {
        padding: 10px;
    }

    /* Адаптация кнопок */
    .btn-custom-secondary,
    .btn-custom-outline {
        padding: 6px 12px;
        font-size: 0.85rem;
        display: block;
        text-align: center;
        margin: 5px 0;
    }

    /* Адаптация кнопки "Наверх" */
    .custom-back-to-top {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        top: -20px;
    }
}

/* --- Для очень маленьких экранов --- */
@media (max-width: 360px) {
    /* Адаптация кнопки "Наверх" */
    .custom-back-to-top {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        top: -20px;
    }
}