/* ==========================================================================
   Базовые стили и переменные для МЧС РК
   ========================================================================== */

   :root {
    --primary: #1E3A8A;          /* Основной синий цвет МЧС */
    --primary-dark: #172554;     /* Тёмный оттенок синего для акцентов */
    --secondary: #DC2626;        /* Красный цвет для предупреждений */
    --background-light: #F5F5F5; /* Светлый фон по умолчанию */
    --background-dark: #1F2937;  /* Тёмный фон для тёмной темы */
    --text-light: #111827;       /* Тёмный текст для светлой темы */
    --text-dark: #E5E7EB;        /* Светлый текст для тёмной темы */
    --border-light: #E5E7EB;     /* Светлая граница для светлой темы */
    --border-dark: #374151;      /* Тёмная граница для тёмной темы */
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.08); /* Стандартная тень */
    --shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.12); /* Тень при наведении */
    --transition: all 0.3s ease-in-out; /* Плавные переходы */
    --font-primary: 'Roboto', 'Helvetica Neue', Arial, sans-serif; /* Основной шрифт */
    --tooltip-bg: #1F2937;       /* Фон всплывающих подсказок */
    --tooltip-text: #FFFFFF;     /* Цвет текста всплывающих подсказок */
    --focus-ring: rgba(30, 58, 138, 0.2); /* Кольцо фокуса */
    --spacing-unit: 8px;         /* Базовая единица отступов */
}

/* ==========================================================================
   Базовые стили для всего документа
   ========================================================================== */

body {
    font-family: var(--font-primary);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    color: var(--text-light);
    background: var(--background-light);
    overflow-x: hidden;
    transition: var(--transition);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.dark-theme {
    color: var(--text-dark);
    background: var(--background-dark);
}

body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* ==========================================================================
   Контейнеры
   ========================================================================== */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: calc(var(--spacing-unit) * 2.5) var(--spacing-unit);
    width: 100%;
    box-sizing: border-box;
}

@media (min-width: 1600px) {
    .container {
        max-width: 90%;
    }
}

@media (min-width: 1920px) {
    .container {
        max-width: 1600px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: calc(var(--spacing-unit) * 2) calc(var(--spacing-unit) * 1.25);
    }
}

@media (max-width: 480px) {
    .container {
        padding: var(--spacing-unit) calc(var(--spacing-unit) * 0.625);
    }
}

/* ==========================================================================
   Заголовки
   ========================================================================== */

h1, h2, h3 {
    color: var(--text-light);
    font-weight: 700;
    margin: calc(var(--spacing-unit) * 2.5) 0;
    line-height: 1.2;
}

h1 {
    font-size: 2.2rem;
    border-bottom: 2px solid var(--primary);
    padding-bottom: var(--spacing-unit);
}

h2 {
    font-size: 1.8rem;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: calc(var(--spacing-unit) * 1.5);
}

h3 {
    font-size: 1.5rem;
}

body.dark-theme h1,
body.dark-theme h2,
body.dark-theme h3 {
    color: var(--text-dark);
}

body.dark-theme h1 {
    border-bottom-color: var(--primary-dark);
}

body.dark-theme h2 {
    border-bottom-color: var(--border-dark);
}

iframe#dash-iframe h1 {
    display: none;
}

/* ==========================================================================
   Ссылки
   ========================================================================== */

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

a:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ==========================================================================
   Формы
   ========================================================================== */

form {
    max-width: 100%;
    width: 100%;
}

form div {
    margin-bottom: calc(var(--spacing-unit) * 2.5);
}

form label {
    display: block;
    margin-bottom: calc(var(--spacing-unit) * 0.625);
    font-weight: 500;
    color: var(--text-light);
}

body.dark-theme form label {
    color: var(--text-dark);
}

form input,
form select,
form textarea {
    width: 100%;
    max-width: 100%;
    padding: var(--spacing-unit);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1rem;
    font-family: var(--font-primary);
    color: var(--text-light);
    background: #fff;
    transition: var(--transition);
}

body.dark-theme form input,
body.dark-theme form select,
body.dark-theme form textarea {
    background: #374151;
    color: var(--text-dark);
    border-color: var(--border-dark);
}

form input:not(:placeholder-shown),
form select:not(:placeholder-shown),
form textarea:not(:placeholder-shown) {
    border-color: var(--primary-dark);
    background: #F9FAFB;
}

body.dark-theme form input:not(:placeholder-shown),
body.dark-theme form select:not(:placeholder-shown),
body.dark-theme form textarea:not(:placeholder-shown) {
    background: #4B5563;
}

form input:focus,
form select:focus,
form textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--focus-ring);
    outline: none;
}

/* ==========================================================================
   Кнопки
   ========================================================================== */

form input[type="submit"],
form button,
.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: calc(var(--spacing-unit) * 1.75) calc(var(--spacing-unit) * 3.5);
    cursor: pointer;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 500;
    font-family: var(--font-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: inline-block;
}

form input[type="submit"]:hover,
form button:hover,
.btn:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-hover);
    transform: translateY(-1px);
}

form input[type="submit"]:active,
form button:active,
.btn:active {
    transform: translateY(1px);
    box-shadow: var(--shadow);
}

form input[type="submit"]:focus,
form button:focus,
.btn:focus {
    outline: 2px solid var(--primary-dark);
    outline-offset: 2px;
}

/* ==========================================================================
   Скрытые элементы
   ========================================================================== */

.hidden {
    display: none;
    opacity: 0;
    height: 0;
    overflow: hidden;
    transition: var(--transition);
}

.hidden.visible {
    display: block;
    opacity: 1;
    height: auto;
}

/* ==========================================================================
   Уведомления
   ========================================================================== */

.text-danger {
    color: var(--secondary);
    font-size: 0.9rem;
    margin-top: calc(var(--spacing-unit) * 0.625);
    display: block;
}

.alert {
    margin-top: calc(var(--spacing-unit) * 2.5);
    padding: calc(var(--spacing-unit) * 2) calc(var(--spacing-unit) * 2.5);
    border-radius: 6px;
    box-shadow: var(--shadow);
    font-size: 1rem;
    font-family: var(--font-primary);
}

.alert-success {
    background: #D1FAE5;
    color: #166534;
    border: 1px solid #BBF7D0;
}

.alert-success::before {
    content: '✅ ';
    margin-right: calc(var(--spacing-unit) * 0.625);
}

.alert-danger {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

.alert-danger::before {
    content: '⚠️ ';
    margin-right: calc(var(--spacing-unit) * 0.625);
}

/* ==========================================================================
   Таблицы
   ========================================================================== */

.table-wrapper {
    width: 100%;
    max-width: none;
    overflow-x: auto;
    margin-top: calc(var(--spacing-unit) * 2.5);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    background: #fff;
    position: relative;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.table-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #1e3c72, #2a5298, #4facfe);
    background-size: 200% 100%;
    animation: gradientMove 3s ease-in-out infinite;
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

body.dark-theme .table-wrapper {
    background: #2D3748;
    border-color: #4A5568;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

table {
    width: 100%;
    min-width: 1200px;
    border-collapse: collapse;
    background: #fff;
    table-layout: auto;
}

body.dark-theme table {
    background: #2D3748;
}

#dashboard-table,
#summary-table {
    min-width: 1200px;
}

th, td {
    border: 1px solid var(--border-light);
    padding: calc(var(--spacing-unit) * 1.75) calc(var(--spacing-unit) * 2);
    text-align: center;
    font-size: 1rem;
    font-family: var(--font-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 100px;
    max-width: 200px;
    position: relative;
}

body.dark-theme th,
body.dark-theme td {
    border-color: var(--border-dark);
}

th {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.95rem;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    font-family: var(--font-primary);
}

td {
    background-color: #fff;
    cursor: pointer;
    position: relative;
}

body.dark-theme td {
    background-color: #2D3748;
    color: var(--text-dark);
}

tfoot td {
    background: #F3F4F6;
    font-weight: 600;
    color: var(--text-light);
}

body.dark-theme tfoot td {
    background: #4B5563;
    color: var(--text-dark);
}

tr:nth-child(even) td {
    background-color: rgba(248, 250, 252, 0.5);
}

body.dark-theme tr:nth-child(even) td {
    background-color: rgba(45, 55, 72, 0.3);
}

tr:hover td {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1;
    position: relative;
    transition: all 0.2s ease;
}

body.dark-theme tr:hover td {
    background: linear-gradient(135deg, #374151 0%, #4A5568 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Анимация появления строк */
tr {
    transition: all 0.2s ease;
    animation: fadeInRow 0.3s ease-out;
}

@keyframes fadeInRow {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

td[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + var(--spacing-unit));
    left: 50%;
    transform: translateX(-50%);
    background: var(--tooltip-bg);
    color: var(--tooltip-text);
    padding: var(--spacing-unit) calc(var(--spacing-unit) * 1.5);
    border-radius: 4px;
    font-size: 0.9rem;
    white-space: normal;
    max-width: 300px;
    z-index: 20;
    box-shadow: var(--shadow);
    animation: fadeInTooltip 0.2s ease forwards;
    pointer-events: none;
}

@keyframes fadeInTooltip {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ==========================================================================
   DataTables
   ========================================================================== */

.dataTables_wrapper {
    position: relative;
    width: 100%;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

body.dark-theme .dataTables_wrapper {
    background: #2D3748;
    border-color: #4A5568;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.dataTables_wrapper .dataTable {
    table-layout: auto;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
}

.dataTables_wrapper .dataTable thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: calc(var(--spacing-unit) * 1.5) calc(var(--spacing-unit) * 1);
    font-weight: 600;
    font-size: 0.95rem;
    text-align: left;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    font-family: var(--font-primary);
}

.dataTables_wrapper .dataTable thead th:first-child {
    border-top-left-radius: 12px;
}

.dataTables_wrapper .dataTable thead th:last-child {
    border-top-right-radius: 12px;
}

.dataTables_wrapper .dataTable thead th:hover {
    background: linear-gradient(135deg, #2a5298 0%, #4facfe 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.dataTables_wrapper .dataTable tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid #f1f5f9;
}

.dataTables_wrapper .dataTable tbody tr:hover {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1;
    position: relative;
}

body.dark-theme .dataTables_wrapper .dataTable tbody tr {
    border-bottom-color: #4A5568;
}

body.dark-theme .dataTables_wrapper .dataTable tbody tr:hover {
    background: linear-gradient(135deg, #374151 0%, #4A5568 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dataTables_wrapper .dataTable tbody td {
    padding: calc(var(--spacing-unit) * 1.25) calc(var(--spacing-unit) * 1);
    font-size: 0.9rem;
    color: #374151;
    border: none;
    vertical-align: middle;
    font-family: var(--font-primary);
    line-height: 1.4;
}

body.dark-theme .dataTables_wrapper .dataTable tbody td {
    color: #e2e8f0;
}

.dataTables_wrapper .dataTable tbody tr:nth-child(even) {
    background: rgba(248, 250, 252, 0.5);
}

body.dark-theme .dataTables_wrapper .dataTable tbody tr:nth-child(even) {
    background: rgba(45, 55, 72, 0.3);
}

/* Стили для ссылок в таблице */
.dataTables_wrapper .dataTable tbody td a {
    color: #1e3c72;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(30, 60, 114, 0.1);
}

.dataTables_wrapper .dataTable tbody td a:hover {
    color: #ffffff;
    background: #1e3c72;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(30, 60, 114, 0.3);
}

body.dark-theme .dataTables_wrapper .dataTable tbody td a {
    color: #4facfe;
    background: rgba(79, 172, 254, 0.1);
}

body.dark-theme .dataTables_wrapper .dataTable tbody td a:hover {
    background: #4facfe;
    color: #ffffff;
}

/* Стили для кнопок в таблице */
.dataTables_wrapper .dataTable tbody td button,
.dataTables_wrapper .dataTable tbody td .btn {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-primary);
}

.dataTables_wrapper .dataTable tbody td button:hover,
.dataTables_wrapper .dataTable tbody td .btn:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

/* Анимация появления строк */
.dataTables_wrapper .dataTable tbody tr {
    animation: fadeInRow 0.3s ease-out;
}

@keyframes fadeInRow {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Стили для пустых ячеек */
.dataTables_wrapper .dataTable tbody td:empty::before {
    content: '—';
    color: #9ca3af;
    font-style: italic;
}

body.dark-theme .dataTables_wrapper .dataTable tbody td:empty::before {
    color: #6b7280;
}

/* ==========================================================================
   Контейнеры для фильтров
   ========================================================================== */

.table-controls {
    margin-bottom: calc(var(--spacing-unit) * 2.5);
    display: block;
}

.table-filters {
    display: flex;
    flex-wrap: wrap;
    gap: calc(var(--spacing-unit) * 2.5);
    padding: calc(var(--spacing-unit) * 2);
    background: #fff;
    border-radius: 6px;
    box-shadow: var(--shadow);
    justify-content: center;
    align-items: center;
    transition: background 0.3s ease;
}

body.dark-theme .table-filters {
    background: #2D3748;
}

.table-filters label {
    font-weight: 500;
    color: var(--text-light);
    font-size: 1rem;
    margin-bottom: calc(var(--spacing-unit) * 0.75);
    font-family: var(--font-primary);
}

body.dark-theme .table-filters label {
    color: var(--text-dark);
}

.table-filters input,
.table-filters select {
    padding: var(--spacing-unit) calc(var(--spacing-unit) * 1.75);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: #fff;
    color: var(--text-light);
    font-family: var(--font-primary);
    transition: var(--transition);
}

body.dark-theme .table-filters input,
body.dark-theme .table-filters select {
    background: #374151;
    color: var(--text-dark);
    border-color: var(--border-dark);
}

.table-filters input:focus,
.table-filters select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--focus-ring);
}

.table-filters select[multiple] {
    height: 100px;
}

.reset-filters {
    background: var(--secondary);
    color: white;
    border: none;
    padding: var(--spacing-unit) calc(var(--spacing-unit) * 2);
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: var(--font-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    margin: 0 auto;
}

.reset-filters:hover {
    background: #B91C1C;
    box-shadow: var(--shadow-hover);
    transform: translateY(-1px);
}

body.dark-theme .reset-filters {
    background: #EF4444;
}

body.dark-theme .reset-filters:hover {
    background: #DC2626;
}

/* ==========================================================================
   Навигация (Bootstrap-совместимая)
   ========================================================================== */

.navbar {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #4facfe 100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    padding: 0 calc(var(--spacing-unit) * 2.5);
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
}

body.dark-theme .navbar {
    background: linear-gradient(135deg, #0c1445 0%, #1a237e 50%, #283593 100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.navbar-brand {
    font-weight: 800;
    color: #ffffff;
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    font-family: var(--font-primary);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.navbar-brand:hover {
    transform: translateY(-2px);
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
    color: #f8f9fa;
}

.navbar-brand::before {
    content: '🚒';
    margin-right: var(--spacing-unit);
    font-size: 1.2rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    animation: fireEngine 2s ease-in-out infinite;
}

@keyframes fireEngine {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.1) rotate(5deg); }
}

body.dark-theme .navbar-brand {
    color: #ffffff;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 5px;
}

.nav-item {
    position: relative;
}

.nav-link {
    color: #ffffff;
    font-weight: 600;
    padding: calc(var(--spacing-unit) * 0.75) calc(var(--spacing-unit) * 1.5);
    font-size: 0.95rem;
    font-family: var(--font-primary);
    transition: all 0.3s ease;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(52, 152, 219, 0.3), transparent);
    transition: left 0.6s ease;
}

.nav-link:hover::before {
    left: 100%;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #3498db, #2ecc71, #f39c12, #e74c3c);
    background-size: 300% 100%;
    animation: gradientMove 3s ease-in-out infinite;
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.nav-link:hover::after {
    transform: scaleX(1);
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.nav-link:hover {
    color: #ffffff;
    background: rgba(52, 152, 219, 0.2);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border-color: rgba(52, 152, 219, 0.4);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.nav-link:active {
    transform: translateY(-1px) scale(1.02);
    transition: all 0.1s ease;
}

body.dark-theme .nav-link {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.3), rgba(46, 204, 113, 0.2));
    border: 2px solid rgba(52, 152, 219, 0.6);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    position: relative;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #3498db, #2ecc71, #f39c12, #e74c3c, #3498db);
    background-size: 400% 400%;
    border-radius: 14px;
    z-index: -1;
    animation: borderGlow 3s ease-in-out infinite;
}

@keyframes borderGlow {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

body.dark-theme .nav-link.active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.25), rgba(46, 204, 113, 0.15));
    border-color: rgba(52, 152, 219, 0.5);
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .navbar {
        padding: 0 var(--spacing-unit);
        height: 60px;
    }
    
    .navbar-brand {
        font-size: 1.3rem;
    }
    
    .navbar-brand::before {
        font-size: 1rem;
    }
    
    .nav-link {
        padding: calc(var(--spacing-unit) * 0.5) var(--spacing-unit);
        font-size: 0.9rem;
    }
}

/* Стили для кнопки-гамбургера мобильного меню */
.navbar-toggler {
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
    transition: all 0.3s ease;
}

.navbar-toggler:hover {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.navbar-toggler:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255, 255, 255, 0.9)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

body.dark-theme .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

body.dark-theme .navbar-toggler:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   Модальное окно
   ========================================================================== */

   .modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.3s ease-in-out forwards;
    backdrop-filter: blur(5px);
}

.modal.closing {
    animation: modalFadeOut 0.3s ease-in-out forwards;
}

.modal-content {
    position: relative;
    background: var(--modal-bg, #ffffff);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: min(90%, 800px);
    max-height: 80vh;
    overflow-y: auto;
    padding: 30px;
    animation: modalSlideIn 0.3s ease-in-out forwards;
    color: var(--modal-text, #333333);
}

.modal-content.closing {
    animation: modalSlideOut 0.3s ease-in-out forwards;
}

/* Заголовок модального окна */
.modal-title {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--modal-primary, #1E3A8A);
    font-size: 1.8em;
    border-bottom: 2px solid var(--modal-primary-light, #DBEAFE);
    padding-bottom: 10px;
}

/* Кнопка закрытия */
.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    font-weight: bold;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--modal-text, #333333);
    transition: transform 0.2s;
    padding: 5px;
    line-height: 1;
}

.modal-close:hover {
    transform: scale(1.2);
    color: var(--modal-primary, #1E3A8A);
}

/* Контейнер данных */
.modal-data {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) 2fr;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
}

.modal-data-header {
    font-weight: 600;
    color: var(--modal-primary-dark, #1E3A8A);
    padding: 8px 12px;
    background: var(--modal-primary-light, #DBEAFE);
    border-radius: 6px;
}

.modal-data-value {
    padding: 8px 12px;
    background: var(--modal-bg-light, #F9FAFB);
    border-radius: 6px;
    word-break: break-word;
}

.modal-data-value.numeric {
    font-family: monospace;
    text-align: right;
}

.modal-data-value.date {
    font-style: italic;
}

/* Кнопки действий */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid var(--modal-border, #E5E7EB);
}

.modal-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.modal-btn-close {
    background: var(--modal-primary, #1E3A8A);
    color: white;
}

.modal-btn-copy {
    background: var(--modal-secondary, #E5E7EB);
    color: var(--modal-text-dark, #111827);
}

.modal-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.modal-btn:active {
    transform: translateY(0);
}

.modal-btn-copy.copied {
    background: var(--modal-success, #4CAF50);
    color: white;
}

/* Полоса прокрутки */
.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: var(--modal-bg-light, #F9FAFB);
}

.modal-content::-webkit-scrollbar-thumb {
    background-color: var(--modal-primary-light, #DBEAFE);
    border-radius: 4px;
}

/* Анимации */
@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes modalSlideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes modalSlideOut {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(-20px); opacity: 0; }
}

/* Темная тема */
body.dark-theme .modal-content {
    --modal-bg: #2D3748;
    --modal-text: #E5E7EB;
    --modal-primary: #4299E1;
    --modal-primary-dark: #EBF8FF;
    --modal-primary-light: #2C5282;
    --modal-bg-light: #4A5568;
    --modal-border: #4A5568;
    --modal-secondary: #4A5568;
    --modal-text-dark: #F7FAFC;
}

body.dark-theme .modal-data-value {
    color: #E5E7EB;
}

body.dark-theme .modal-content::-webkit-scrollbar-thumb {
    background-color: #4A5568;
}

/* ==========================================================================
   Спиннер загрузки
   ========================================================================== */

.loader {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.loader::before {
    content: '🚒';
    font-size: 3rem;
    display: block;
    text-align: center;
    animation: spin 1s linear infinite;
}

/* ==========================================================================
   Кнопки управления
   ========================================================================== */

button[style*="position: fixed; bottom: 20px; left: 20px;"] {
    padding: calc(var(--spacing-unit) * 1.5);
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: var(--transition);
    font-size: 1.2rem;
    font-family: var(--font-primary);
}

body.dark-theme button[style*="position: fixed; bottom: 20px; left: 20px;"] {
    background: #374151;
    border-color: var(--border-dark);
}

button[style*="position: fixed; bottom: 20px; left: 20px;"]:hover {
    background: #EFF6FF;
    box-shadow: var(--shadow-hover);
}

body.dark-theme button[style*="position: fixed; bottom: 20px; left: 20px;"]:hover {
    background: #4B5563;
}

button[style*="position: fixed; bottom: 20px; right: 20px;"] {
    padding: calc(var(--spacing-unit) * 1.5) calc(var(--spacing-unit) * 2);
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: var(--transition);
    font-size: 1.2rem;
    font-family: var(--font-primary);
}

button[style*="position: fixed; bottom: 20px; right: 20px;"]:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-hover);
}

/* ==========================================================================
   Карточки аналитики
   ========================================================================== */

.analytics-cards {
    display: flex;
    flex-wrap: wrap;
    gap: calc(var(--spacing-unit) * 2.5);
    justify-content: space-between;
    margin: calc(var(--spacing-unit) * 2.5) 0;
}

.analytics-cards > div {
    flex: 1 1 300px;
    min-width: 250px;
    padding: calc(var(--spacing-unit) * 2.5);
    box-sizing: border-box;
    border-radius: 6px;
    box-shadow: var(--shadow);
    background: #fff;
    text-align: center;
    transition: var(--transition);
}

body.dark-theme .analytics-cards > div {
    background: #2D3748;
}

.analytics-cards > div:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.analytics-cards > div h3 {
    font-size: 1.2rem;
    margin-bottom: var(--spacing-unit);
    color: var(--text-light);
    font-family: var(--font-primary);
}

.analytics-cards > div p {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin: var(--spacing-unit) 0;
    font-family: var(--font-primary);
}

body.dark-theme .analytics-cards > div h3 {
    color: var(--text-dark);
}

body.dark-theme .analytics-cards > div p {
    color: var(--text-dark);
}

/* ==========================================================================
   Карта
   ========================================================================== */

#map {
    width: 100%;
    height: 600px;
    margin: calc(var(--spacing-unit) * 2.5) 0;
    border-radius: 6px;
    box-shadow: var(--shadow);
    background: #fff;
}

body.dark-theme #map {
    background: #2D3748;
}

/* Контейнер для всех графиков */
.chart-container {
    display: flex;
    flex-direction: column; /* отображение по вертикали */
    align-items: center;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    overflow: visible;
}

/* Каждый график */
.dash-graph {
    width: 100%;
    max-width: 1000px;
    margin: 2rem auto;
    border-radius: 6px;
    box-shadow: var(--shadow);
    background: #fff;
    padding: 10rem;
}

/* Dark theme поддержка */
body.dark-theme .dash-graph {
    background: #2D3748;
}

/* Растягивание canvas */
canvas {
    width: 100% !important;
    height: auto !important;
}

/* ==========================================================================
   Переключатель колонок
   ========================================================================== */

.column-toggle {
    display: flex;
    flex-wrap: wrap;
    gap: calc(var(--spacing-unit) * 2);
    padding: var(--spacing-unit);
    background: #fff;
    border-radius: 6px;
    box-shadow: var(--shadow);
    margin-top: var(--spacing-unit);
}

body.dark-theme .column-toggle {
    background: #2D3748;
}

.column-toggle label {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-light);
    cursor: pointer;
}

body.dark-theme .column-toggle label {
    color: var(--text-dark);
}

.column-toggle input[type="checkbox"] {
    margin-right: calc(var(--spacing-unit) * 0.625);
}

/* ==========================================================================
   Анимации
   ========================================================================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Адаптивность
   ========================================================================== */

@media (max-width: 1200px) {
    .container {
        max-width: 1000px;
    }
    .analytics-cards > div {
        flex: 1 1 45%;
    }
}

@media (max-width: 992px) {
    .navbar {
        padding: var(--spacing-unit) calc(var(--spacing-unit) * 2);
    }
    .nav-link {
        padding: calc(var(--spacing-unit) * 0.75) calc(var(--spacing-unit) * 1.5);
    }
    th, td {
        padding: var(--spacing-unit);
        font-size: 0.85rem;
        min-width: 80px;
    }
    .analytics-cards > div {
        flex: 1 1 45%;
    }
    .dash-graph {
        flex: 1 1 100%;
    }
}

@media (max-width: 768px) {
    .container {
        padding: calc(var(--spacing-unit) * 2);
    }
    form {
        max-width: 90%;
        margin: calc(var(--spacing-unit) * 2.5) auto;
    }
    .table-wrapper {
        overflow-x: auto;
    }
    th, td {
        padding: calc(var(--spacing-unit) * 0.75);
        font-size: 0.8rem;
        min-width: 60px;
    }
    h1 {
        font-size: 1.9rem;
    }
    h2 {
        font-size: 1.5rem;
    }
    .table-filters {
        flex-direction: column;
        gap: var(--spacing-unit);
        padding: calc(var(--spacing-unit) * 1.5);
    }
    .analytics-cards > div {
        flex: 1 1 100%;
    }
    #map {
        height: 400px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: var(--spacing-unit);
    }
    form input,
    form select,
    form textarea {
        font-size: 0.95rem;
        padding: calc(var(--spacing-unit) * 0.75);
    }
    form input[type="submit"],
    form button {
        width: 100%;
        padding: calc(var(--spacing-unit) * 1.5);
        font-size: 1rem;
    }
    th, td {
        padding: calc(var(--spacing-unit) * 0.5);
        font-size: 0.85rem;
        min-width: 50px;
    }
    h1 {
        font-size: 1.5rem;
    }
    h2 {
        font-size: 1.3rem;
    }
    #map {
        height: 300px;
    }
}

@media (max-width: 768px) {
    .table-wrapper table tr td {
        display: none;
    }
    .table-wrapper table tr td:first-child {
        display: flex;
        align-items: center;
        width: 100%;
        max-width: none;
        white-space: normal;
    }
    .table-wrapper table tr.expanded td {
        display: block;
        border-top: none;
        padding-left: calc(var(--spacing-unit) * 3.75);
    }
    .table-wrapper table tr td:first-child .toggle-row {
        display: inline-block;
    }
    .table-wrapper table tr.expanded td:first-child {
        border-bottom: none;
    }
}



/* ==========================================================================
   Дополнительные элементы
   ========================================================================== */

.export-button-wrapper {
    text-align: center;
    margin: calc(var(--spacing-unit) * 2.5) 0;
}

body.dark-theme iframe {
    background: var(--background-dark);
}

#dashboard-table {
    display: table;
    width: 100%;
}

#dashboard-table tbody {
    display: table-row-group;
}

#dashboard-table tr {
    display: table-row;
}

#dashboard-table td, #dashboard-table th {
    display: table-cell;
}

.region-filter {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background: #fff;
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: var(--shadow);
    border-radius: 6px;
    padding: var(--spacing-unit);
    z-index: 1000;
    border: 1px solid var(--border-light);
}

body.dark-theme .dropdown-content {
    background: var(--background-dark);
    border-color: var(--border-dark);
}

.dropdown-content div {
    margin: calc(var(--spacing-unit) * 0.625) 0;
}

.dropdown-content label {
    display: flex;
    align-items: center;
    color: var(--text-light);
    font-size: 0.9rem;
}

body.dark-theme .dropdown-content label {
    color: var(--text-dark);
}

.dropdown-content input[type="checkbox"] {
    margin-right: var(--spacing-unit);
}

.download-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: var(--spacing-unit) calc(var(--spacing-unit) * 2);
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: var(--font-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    margin-top: var(--spacing-unit);
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.download-btn:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-hover);
    transform: translateY(-1px);
}

body.dark-theme .download-btn {
    background: var(--primary-dark);
}

body.dark-theme .download-btn:hover {
    background: var(--primary);
}

#map {
    position: relative;
}

.chart-container {
    display: flex;
    flex-wrap: wrap;
    gap: calc(var(--spacing-unit) * 2);
    justify-content: space-between;
    margin: calc(var(--spacing-unit) * 2.5) 0;
}

.dash-graph {
    flex: 1 1 300px;
    min-width: 250px;
    margin: var(--spacing-unit) 0;
    border-radius: 6px;
    box-shadow: var(--shadow);
    background: #fff;
    padding: var(--spacing-unit);
    position: Ob;
    max-height: 350px;
    overflow: hidden;
}

body.dark-theme .dash-graph {
    background: #2D3748;
}

.dash-graph h3 {
    font-size: 1rem;
    margin: 0 0 calc(var(--spacing-unit) * 0.625) 0;
    display: inline-block;
}

.dash-graph canvas {
    max-height: 250px;
    width: 100%;
}

.toggle-chart {
    position: absolute;
    top: var(--spacing-unit);
    right: var(--spacing-unit);
    padding: calc(var(--spacing-unit) * 0.625) var(--spacing-unit);
    font-size: 0.8rem;
    min-width: 0;
}

.dash-graph canvas[style*="display: none"] + .download-btn {
    display: none;
}

.download-icon {
    transition: var(--transition);
}

.download-icon:hover {
    background: var(--primary-dark) !important;
    transform: scale(1.1);
}

@media print {
    .download-icon {
        display: none !important;
    }
}

/* ==========================================================================
   Стили для фильтров таблицы
   ========================================================================== */

.table-filters {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: calc(var(--spacing-unit) * 2);
    margin: calc(var(--spacing-unit) * 2) 0;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.table-filters:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-1px);
}

body.dark-theme .table-filters {
    background: linear-gradient(135deg, #2d3748 0%, #1f2937 100%);
    border-color: var(--border-dark);
}

/* ==========================================================================
   Фильтры
   ========================================================================== */

.filters-form {
    display: flex;
    flex-wrap: wrap;
    gap: calc(var(--spacing-unit) * 2);
    align-items: flex-end;
    justify-content: flex-start;
}

.filter-group {
    display: flex;
    flex-direction: column;
    min-width: 200px;
    max-width: 250px;
    flex: 0 1 auto;
    align-items: stretch;
}

.filter-label {
    height: 20px;
    line-height: 20px;
    margin-bottom: calc(var(--spacing-unit) * 0.75);
    display: flex;
    align-items: center;
    gap: calc(var(--spacing-unit) * 0.75);
    font-weight: 600;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: calc(var(--spacing-unit) * 0.75);
    transition: var(--transition);
    height: 20px;
    line-height: 20px;
}

body.dark-theme .filter-label {
    color: var(--text-dark);
}

.filter-input,
.filter-select {
    padding: calc(var(--spacing-unit) * 1.25);
    border: 2px solid var(--border-light);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: var(--font-primary);
    background: #ffffff;
    color: var(--text-light);
    transition: var(--transition);
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    box-sizing: border-box;
    line-height: 1.2;
    align-self: flex-end;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
    transform: translateY(-1px);
}

.filter-input::placeholder {
    color: #9ca3af;
    opacity: 0.8;
}

body.dark-theme .filter-input,
body.dark-theme .filter-select {
    background: #374151;
    border-color: var(--border-dark);
    color: var(--text-dark);
}

body.dark-theme .filter-input:focus,
body.dark-theme .filter-select:focus {
    border-color: var(--primary);
    background: #4b5563;
}

.filter-actions {
    display: flex;
    gap: var(--spacing-unit);
    align-items: flex-end;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-self: flex-end;
}



.btn-icon {
    font-size: 1rem;
    opacity: 0.9;
}

/* Стили для селектора размера страницы */
#page-size-select {
    min-width: 80px;
    text-align: center;
    font-weight: 500;
}

#page-size-select option {
    text-align: center;
    padding: 4px 8px;
}

/* Адаптивность для фильтров */
@media (max-width: 768px) {
    .filters-form {
        flex-wrap: wrap;
        overflow-x: visible;
    }
    
    .filter-group {
        min-width: 100%;
        max-width: 100%;
        margin-bottom: calc(var(--spacing-unit) * 1.5);
    }
    
    .filter-actions {
        margin-top: calc(var(--spacing-unit) * 1.5);
        width: 100%;
        justify-content: stretch;
    }
    
    .btn-primary,
    .btn-secondary {
        flex: 1;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .table-filters {
        padding: calc(var(--spacing-unit) * 1.5);
        margin: var(--spacing-unit) 0;
    }
    
    .filter-input,
    .filter-select {
        padding: var(--spacing-unit);
        min-height: 40px;
    }
    
    .btn-primary,
    .btn-secondary {
        padding: var(--spacing-unit) calc(var(--spacing-unit) * 1.5);
        min-height: 40px;
        font-size: 0.85rem;
    }
    
    .filters-form {
        gap: calc(var(--spacing-unit) * 1);
    }
    
    .filter-group {
        min-width: calc(50% - var(--spacing-unit));
        max-width: calc(50% - var(--spacing-unit));
    }
}

/* ==========================================================================
   Кнопки в фильтрах
   ========================================================================== */

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: calc(var(--spacing-unit) * 1.25) calc(var(--spacing-unit) * 2);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-primary);
    cursor: pointer;
    transition: var(--transition);
    display: inline-block;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    box-sizing: border-box;
    box-shadow: var(--shadow);
    align-self: flex-end;
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #6b7280;
    color: white;
    border: none;
    padding: calc(var(--spacing-unit) * 1.25) calc(var(--spacing-unit) * 2);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-primary);
    cursor: pointer;
    transition: var(--transition);
    display: inline-block;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    text-decoration: none;
    box-shadow: var(--shadow);
    box-sizing: border-box;
    align-self: flex-end;
}

.btn-secondary:hover {
    background: #4b5563;
    box-shadow: var(--shadow-hover);
    transform: translateY(-1px);
}

/* ==========================================================================
   Пагинация
   ========================================================================== */

.pagination-controls {
    margin: 10px 0;
    display: flex;
    gap: 10px;
    align-items: center;
}

.pagination-controls a {
    background: var(--primary);
    color: white;
    padding: calc(var(--spacing-unit) * 0.75) calc(var(--spacing-unit) * 1.5);
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.pagination-controls a:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-hover);
    transform: translateY(-1px);
    color: white;
    text-decoration: none;
}

.pagination-controls a[style*="pointer-events: none"] {
    background: #cbd5e0;
    color: #718096;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.pagination-controls span {
    color: var(--text-light);
    font-weight: 500;
    padding: calc(var(--spacing-unit) * 0.75) calc(var(--spacing-unit) * 1.5);
}

body.dark-theme .pagination-controls span {
    color: var(--text-dark);
}

/* Адаптивность для таблиц */
@media (max-width: 768px) {
    .table-wrapper {
        padding: var(--spacing-unit);
        margin: var(--spacing-unit) 0;
        border-radius: 12px;
    }
    
    .dataTables_wrapper .dataTable thead th {
        padding: calc(var(--spacing-unit) * 1) calc(var(--spacing-unit) * 0.5);
        font-size: 0.85rem;
    }
    
    .dataTables_wrapper .dataTable tbody td {
        padding: calc(var(--spacing-unit) * 1) calc(var(--spacing-unit) * 0.5);
        font-size: 0.85rem;
    }
    
    .dataTables_wrapper .dataTable tbody td a,
    .dataTables_wrapper .dataTable tbody td button,
    .dataTables_wrapper .dataTable tbody td .btn {
        padding: 4px 6px;
        font-size: 0.8rem;
    }
    
    th, td {
        padding: calc(var(--spacing-unit) * 1.25) calc(var(--spacing-unit) * 1);
        font-size: 0.9rem;
        min-width: 80px;
        max-width: 150px;
    }
    
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .dataTables_wrapper .dataTable {
        min-width: 800px;
    }
    
    table {
        min-width: 800px;
    }
}

/* Улучшенные границы таблицы */
.dataTables_wrapper .dataTable {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}

.dataTables_wrapper .dataTable thead th {
    border-right: 2px solid #cbd5e1;
    border-bottom: 3px solid #94a3b8;
    position: relative;
}

.dataTables_wrapper .dataTable thead th:last-child {
    border-right: none;
}

.dataTables_wrapper .dataTable thead th::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #64748b, transparent);
}

.dataTables_wrapper .dataTable tbody tr {
    border-bottom: 1px solid #e2e8f0;
}

.dataTables_wrapper .dataTable tbody tr:last-child {
    border-bottom: none;
}

.dataTables_wrapper .dataTable tbody td {
    border-right: 1px solid #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
}

.dataTables_wrapper .dataTable tbody td:last-child {
    border-right: none;
}

.dataTables_wrapper .dataTable tbody tr:hover td {
    border-color: #cbd5e1;
    border-right-color: #94a3b8;
}

/* Границы для обычных таблиц */
table {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    border-right: 2px solid #cbd5e1;
    border-bottom: 3px solid #94a3b8;
    position: relative;
}

th:last-child {
    border-right: none;
}

th::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #64748b, transparent);
}

td {
    border-right: 1px solid #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
}

td:last-child {
    border-right: none;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    border-color: #cbd5e1;
    border-right-color: #94a3b8;
}

/* Темная тема для границ */
body.dark-theme .dataTables_wrapper .dataTable {
    border-color: #4A5568;
}

body.dark-theme .dataTables_wrapper .dataTable thead th {
    border-right-color: #2D3748;
    border-bottom-color: #1A202C;
}

body.dark-theme .dataTables_wrapper .dataTable thead th::after {
    background: linear-gradient(90deg, transparent, #2D3748, transparent);
}

body.dark-theme .dataTables_wrapper .dataTable tbody tr {
    border-bottom-color: #4A5568;
}

body.dark-theme .dataTables_wrapper .dataTable tbody td {
    border-right-color: #2D3748;
    border-bottom-color: #4A5568;
}

body.dark-theme .dataTables_wrapper .dataTable tbody tr:hover td {
    border-color: #2D3748;
    border-right-color: #1A202C;
}

body.dark-theme table {
    border-color: #4A5568;
}

body.dark-theme th {
    border-right-color: #2D3748;
    border-bottom-color: #1A202C;
}

body.dark-theme th::after {
    background: linear-gradient(90deg, transparent, #2D3748, transparent);
}

body.dark-theme td {
    border-right-color: #2D3748;
    border-bottom-color: #4A5568;
}

body.dark-theme tr:hover td {
    border-color: #2D3748;
    border-right-color: #1A202C;
}



