/* 
============================================
   ТИПОГРАФИКА: Локальный шрифт Inter
============================================
*/
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  src: local(''),
       url('../fonts/inter-cyrillic-400-normal.woff2') format('woff2'),
       url('../fonts/inter-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  src: local(''),
       url('../fonts/inter-cyrillic-600-normal.woff2') format('woff2'),
       url('../fonts/inter-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  src: local(''),
       url('../fonts/inter-cyrillic-700-normal.woff2') format('woff2'),
       url('../fonts/inter-latin-700-normal.woff2') format('woff2');
}

body {
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8f9fa;
    color: #334155;
}

[data-bs-theme="dark"] body {
    background-color: #0f172a;
    color: #e2e8f0;
}

/* 
============================================
   КАРТОЧКИ (Modern Dashboard Cards)
============================================
*/
.card {
    border: none;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: box-shadow 0.2s ease-in-out;
    background-color: #ffffff;
    margin-bottom: 1.5rem;
}

.card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
}

.card-header {
    background-color: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* Карточки KPI (сводные данные) */
.kpi-card {
    display: flex;
    align-items: center;
    padding: 1.5rem;
}
.kpi-icon {
    font-size: 2.5rem;
    margin-right: 1.5rem;
    opacity: 0.8;
}
.kpi-content h5 {
    margin: 0;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}
.kpi-content h2 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
}

[data-bs-theme="dark"] .card {
    background-color: #1e293b;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
}
[data-bs-theme="dark"] .card-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
[data-bs-theme="dark"] .kpi-content h5 { color: #94a3b8; }
[data-bs-theme="dark"] .kpi-content h2 { color: #f8fafc; }

/* 
============================================
   GLASSMORPHISM & HEADER
============================================
*/
.glass-header {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

[data-bs-theme="dark"] .glass-header {
    background: rgba(15, 23, 42, 0.8) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.navbar .nav-item.dropdown { position: relative; }
.navbar .dropdown-menu { position: absolute; top: 100%; }

/* 
============================================
   SIDEBAR (Боковое меню)
============================================
*/
.sidebar-modern {
    background: #1e293b; /* Всегда темный премиальный слейт для бокового меню */
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
    z-index: 100;
}
.sidebar-modern .nav-link {
    color: #94a3b8;
    border-radius: 0.5rem;
    margin: 0.2rem 0.5rem;
    padding: 0.65rem 1rem;
    font-weight: 500;
    transition: all 0.2s;
}
.sidebar-modern .nav-link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.05);
}
.sidebar-modern .nav-link.active {
    color: #ffffff;
    background-color: #3b82f6; /* Modern blue */
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.25);
}
.sidebar-modern .sidebar-heading {
    color: #94a3b8;
    padding: 0 1rem;
    margin-left: 0.5rem;
    margin-right: 0.5rem;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

[data-bs-theme="dark"] .sidebar-modern {
    background: #0f172a;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: none;
}

/* 
============================================
   DATATABLES (Стилизация под Modern UI)
============================================
*/
.dataTables_wrapper {
    padding: 0.5rem;
}
.dataTables_wrapper .form-group { display: inline-block; margin: 0 1rem 0 0; }
.dataTables_wrapper label { line-height: 1; }
td .btn-xs { padding: .1rem .4rem; font-size: .8em; }

table.dataTable.table-modern {
    border-collapse: separate;
    border-spacing: 0;
    border: none;
}
table.dataTable.table-modern thead th {
    border-bottom: 2px solid #e2e8f0;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}
table.dataTable.table-modern tbody tr {
    transition: background-color 0.15s;
}
table.dataTable.table-modern tbody tr:hover {
    background-color: #f1f5f9 !important;
}
table.dataTable.table-modern tbody td {
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

[data-bs-theme="dark"] table.dataTable.table-modern thead th {
    border-bottom: 2px solid #334155;
    color: #94a3b8;
}
[data-bs-theme="dark"] table.dataTable.table-modern tbody tr:hover {
    background-color: #334155 !important;
}
[data-bs-theme="dark"] table.dataTable.table-modern tbody td {
    border-bottom: 1px solid #1e293b;
}

[data-bs-theme="dark"] .dataTables_length label,
[data-bs-theme="dark"] .dataTables_filter label,
[data-bs-theme="dark"] .dataTables_info {
    color: #cbd5e1;
}

/* Пагинация */
.page-link {
    border: none;
    color: #64748b;
    border-radius: 0.375rem;
    margin: 0 0.125rem;
}
.page-item.active .page-link {
    background-color: #3b82f6;
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}
[data-bs-theme="dark"] .page-link {
    background-color: transparent;
    color: #cbd5e1;
}
[data-bs-theme="dark"] .page-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
}
[data-bs-theme="dark"] .page-item.active .page-link {
    background-color: #3b82f6;
}
[data-bs-theme="dark"] .page-item.disabled .page-link {
    color: #475569;
}

/* 
============================================
   ОСТАЛЬНЫЕ УТИЛИТЫ И КНОПКИ
============================================
*/
.theme-toggle-btn {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}
.theme-toggle-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #0f172a;
}
[data-bs-theme="dark"] .theme-toggle-btn { color: #94a3b8; }
[data-bs-theme="dark"] .theme-toggle-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.td-wrap-text { white-space: normal !important; word-break: break-word; }
.toggle-speech { color: #3b82f6; cursor: pointer; font-size: 0.8em; font-weight: 600; text-decoration: none; display: block; margin-top: 5px; }
.toggle-speech:hover { text-decoration: underline; }
[data-bs-theme="dark"] .toggle-speech { color: #60a5fa; }

/* 
============================================
   ВСТРАИВАЕМЫЙ РЕЖИМ (a__=1)
   Уменьшение шрифта на ~20% для компактности
============================================
*/
body.embedded-view {
    font-size: 0.8rem;
}
body.embedded-view table.dataTable,
body.embedded-view .table {
    font-size: 0.8rem;
}
body.embedded-view .table-sm > :not(caption) > * > * {
    padding: 0.2rem 0.35rem;
}
body.embedded-view .form-control,
body.embedded-view .form-select,
body.embedded-view .col-form-label,
body.embedded-view .btn,
body.embedded-view .dataTables_wrapper,
body.embedded-view .dataTables_info,
body.embedded-view .dataTables_paginate,
body.embedded-view .dataTables_filter input,
body.embedded-view .dataTables_length select {
    font-size: 0.8rem;
}
body.embedded-view .badge {
    font-size: 0.72rem;
}
body.embedded-view td .btn-xs {
    padding: 0.05rem 0.3rem;
    font-size: 0.72rem;
}
body.embedded-view .toggle-speech {
    font-size: 0.75rem;
}