/* ============================================
   ОСНОВНЫЕ СТИЛИ
   ============================================ */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
}

/* Навигация */
.navbar {
    background: linear-gradient(135deg, #f57c00 0%, #e65100 100%);
    padding: 15px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.navbar-brand {
    color: white !important;
    font-size: 1.5rem;
    font-weight: 600;
    text-decoration: none;
}

.navbar-brand:hover {
    color: white !important;
}

/* Боковое меню */
.sidebar {
    background-color: white;
    min-height: calc(100vh - 100px);
    padding: 20px 0;
    box-shadow: 2px 0 8px rgba(0,0,0,0.05);
}

.sidebar .nav-link {
    color: #333;
    padding: 12px 20px;
    margin: 5px 15px;
    border-radius: 8px;
    text-decoration: none;
    display: block;
    transition: all 0.3s ease;
}

.sidebar .nav-link:hover {
    background-color: #fff3e0;
    color: #f57c00;
}

.sidebar .nav-link.active {
    background-color: #f57c00;
    color: white;
}

.sidebar .nav-link i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
}

/* Основной контент */
.content {
    padding: 30px;
}

/* Карточки */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.card-header {
    border-radius: 12px 12px 0 0 !important;
    padding: 15px 20px;
    font-weight: 600;
}

/* Кнопки */
.btn {
    border-radius: 8px;
    padding: 8px 20px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Алерты */
.alert {
    border-radius: 8px;
    border: none;
    border-left: 4px solid;
}

.alert-success {
    background-color: #e8f5e9;
    color: #2e7d32;
    border-left-color: #4caf50;
}

.alert-danger {
    background-color: #ffebee;
    color: #c62828;
    border-left-color: #f44336;
}

.alert-warning {
    background-color: #fff3e0;
    color: #e65100;
    border-left-color: #ff9800;
}

.alert-info {
    background-color: #e3f2fd;
    color: #1565c0;
    border-left-color: #2196f3;
}

/* ============================================
   ОБЩИЕ СТИЛИ ТАБЛИЦ
   ============================================ */
.table {
    background-color: white;
    border-radius: 8px;
    margin-bottom: 0;
}

.table thead {
    background-color: #f5f5f5;
}

/* ============================================
   МАТРИЦА ОБУЧЕНИЯ — КОНТЕЙНЕР
   ============================================ */
.matrix-table-container {
    overflow: auto;
    max-height: calc(100vh - 320px);
    max-width: 100%;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background-color: white;
    position: relative;
}

/* ============================================
   МАТРИЦА ОБУЧЕНИЯ — ТАБЛИЦА
   ВАЖНО: overflow: visible перебивает overflow: hidden от общего .table
   Это необходимо для работы position: sticky
   ============================================ */
.training-table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    table-layout: auto !important;
    margin-bottom: 0;
    font-size: 0.75rem;
    overflow: visible !important;
    border-radius: 0 !important;
}

/* Ячейки таблицы */
.training-table th,
.training-table td {
    padding: 4px 6px !important;
    vertical-align: middle;
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
    border-right: 1px solid #dee2e6 !important;
    border-bottom: 1px solid #dee2e6 !important;
}

/* Последняя колонка без правой границы */
.training-table th:last-child,
.training-table td:last-child {
    border-right: none !important;
}

/* ============================================
   ФИКСАЦИЯ ШАПКИ (при вертикальной прокрутке)
   ============================================ */
.training-table thead th {
    position: sticky !important;
    top: 0 !important;
    background-color: #212529 !important;
    color: white !important;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    font-weight: 600;
    text-align: center;
}

/* ============================================
   ФИКСАЦИЯ ПЕРВОЙ КОЛОНКИ (Ф.И.О.)
   ============================================ */
.training-table th:first-child,
.training-table td:first-child {
    position: sticky !important;
    left: 0 !important;
    background-color: #ffffff !important;
    z-index: 50;
    min-width: 150px !important;
    max-width: 180px !important;
    border-right: 2px solid #dee2e6 !important;
    font-weight: 500;
}

/* ============================================
   ВТОРАЯ КОЛОНКА (Должность)
   ============================================ */
.training-table th:nth-child(2),
.training-table td:nth-child(2) {
    min-width: 120px !important;
    max-width: 150px !important;
    border-right: 1px solid #dee2e6 !important;
}

/* ============================================
   УГЛОВЫЕ ЯЧЕЙКИ (пересечение шапки и первой колонки)
   Самый высокий z-index, чтобы были поверх всего
   ============================================ */
.training-table thead th:first-child,
.training-table thead th:nth-child(2) {
    z-index: 150 !important;
    background-color: #212529 !important;
}

/* ============================================
   КОЛОНКИ ПРОГРАММ
   ============================================ */
.training-table th:not(:first-child):not(:nth-child(2)),
.training-table td:not(:first-child):not(:nth-child(2)) {
    min-width: 70px;
    max-width: 90px;
    text-align: center;
}

/* ============================================
   ЦВЕТА СТАТУСОВ ЯЧЕЕК (ОДИН БЛОК, без дублей)
   ============================================ */

/* Зеленый — срок действует (> 1 месяца) */
.training-table .status-green {
    background-color: #28a745 !important;
    color: #ffffff !important;
    font-weight: bold;
}

/* Желтый — срок истекает (< 1 месяца) */
.training-table .status-yellow {
    background-color: #ffc107 !important;
    color: #000000 !important;
    font-weight: bold;
}

/* Красный — просрочено */
.training-table .status-red {
    background-color: #dc3545 !important;
    color: #ffffff !important;
    font-weight: bold;
}

/* Синий — план */
.training-table .status-blue {
    background-color: #007bff !important;
    color: #ffffff !important;
    font-weight: bold;
}

/* Серый — освобождён от обучения */
.training-table .status-gray {
    background-color: #6c757d !important;
    color: #ffffff !important;
    font-weight: bold;
}

/* Белый — нет данных */
.training-table .status-white {
    background-color: #ffffff !important;
    color: #333333;
}

/* ============================================
   ВЫДЕЛЕНИЕ ЯЧЕЕК
   ============================================ */
.training-cell.selected {
    outline: 5px solid #000000 !important;
    outline-offset: -2px;
    z-index: 10;
    position: relative;
}

/* ============================================
   ПОЛЕ ВВОДА В ЯЧЕЙКЕ
   ============================================ */
.training-cell input {
    border: none;
    background: transparent;
    text-align: center;
    font-weight: bold;
    width: 100%;
    padding: 2px;
}

.training-cell input:focus {
    outline: none;
    background-color: rgba(255, 255, 255, 0.9);
}

/* ============================================
   МОДАЛЬНЫЕ ОКНА
   ============================================ */
.modal-header {
    border-radius: 8px 8px 0 0 !important;
}

.modal-content {
    border-radius: 8px;
    border: none;
}

/* ============================================
   ФИЛЬТР ПО ФАМИЛИИ
   ============================================ */
#employeeFilter {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.875rem;
}

#employeeFilter:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* ============================================
   ПРОЧИЕ ЭЛЕМЕНТЫ
   ============================================ */
.badge {
    font-weight: 500;
    padding: 4px 8px;
}

.form-control-sm {
    padding: 4px 8px;
    font-size: 0.875rem;
}

.form-label {
    font-weight: 500;
    margin-bottom: 4px;
    font-size: 0.875rem;
}
/* ============================================
   УТИЛИТЫ
   ============================================ */
.text-nowrap-custom {
    white-space: nowrap;
}