/* Цветовая схема БумХимИнвест */
:root {
    --primary-orange: #FD4B01;
    --primary-purple: #6B349C;
    --secondary-yellow: #FECD2A;
    --secondary-blue: #4C4DC2;
    --secondary-light-blue: #97B9FF;
    --secondary-dark: #182641;
    --secondary-teal: #00BF93;
    --secondary-dark-teal: #015057;
    --secondary-lime: #E1FF01;
    --secondary-black: #1E1F21;
    
    /* Корпоративные шрифты */
    --font-heading: 'Inter', Arial, sans-serif;
    --font-body: 'Inter', Arial, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: #f5f6fa;
    color: #182641;
    overflow-x: hidden;
    font-size: 1rem;
    line-height: 1.5;
}

/* Заголовки - Inter */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-body);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1, .h1 {
    font-size: 2.5rem;
}

h2, .h2 {
    font-size: 2rem;
}

h3, .h3 {
    font-size: 1.75rem;
}

h4, .h4 {
    font-size: 1.5rem;
}

h5, .h5 {
    font-size: 1.25rem;
}

h6, .h6 {
    font-size: 1rem;
}

/* Подзаголовки - Inter */
.subtitle,
.lead,
small,
.text-muted,
p,
span,
div,
a,
button,
input,
textarea,
select,
label {
    font-family: var(--font-body);
}

/* Цитаты - Inter */
blockquote,
cite {
    font-family: var(--font-body);
}

/* Сноски - Inter */
.footnote,
small {
    font-family: var(--font-body);
}

/* ========== Wrapper & Layout ========== */
.wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
}

/* ========== Sidebar ========== */
.sidebar {
    min-width: 280px;
    max-width: 280px;
    background: linear-gradient(180deg, #182641 0%, #1E1F21 100%);
    color: white;
    transition: all 0.3s;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar.active {
    min-width: 80px;
    max-width: 80px;
}

.sidebar-header {
    padding: 15px 20px;
    background: rgba(107, 52, 156, 0.2);
    border-bottom: 2px solid rgba(253, 75, 1, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.sidebar.active .sidebar-header {
    padding: 15px 10px;
    flex-direction: column;
    gap: 10px;
}

.sidebar.active .sidebar-toggle {
    align-self: center;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    transition: all 0.3s;
    flex: 1;
}

.logo-full {
    max-height: 40px;
    max-width: 180px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.logo-mini {
    max-height: 40px;
    max-width: 40px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: none;
}

.sidebar.active .logo-container {
    width: 100%;
}

.sidebar.active .logo-full {
    display: none;
}

.sidebar.active .logo-mini {
    display: block;
}

.sidebar-toggle {
    color: white;
    font-size: 1.5rem;
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

.sidebar-toggle:hover {
    color: var(--primary-orange);
}

.sidebar-toggle i {
    transition: transform 0.3s;
}

.sidebar.active .sidebar-toggle i {
    transform: rotate(90deg);
}

.components {
    padding: 20px 0;
    overflow: hidden;
}

.components li {
    margin: 5px 0;
    overflow: hidden;
}

.components li a {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.components li a:hover {
    background: rgba(253, 75, 1, 0.1);
    color: white;
    border-left-color: var(--primary-orange);
}

.components li.active > a {
    background: rgba(253, 75, 1, 0.2);
    color: white;
    border-left-color: var(--primary-orange);
}

.components li a i {
    font-size: 1.3rem;
    margin-right: 15px;
    width: 25px;
    text-align: center;
}

.components li a span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar.active .components li a span {
    display: none;
}

.sidebar.active .components li a {
    justify-content: center;
    padding: 15px;
}

.sidebar.active .components li a i {
    margin-right: 0;
}

/* ========== User Menu Accordion ========== */
.user-menu-item {
    margin-bottom: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.user-menu-toggle {
    padding: 12px 15px;
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    gap: 10px;
}

.user-menu-toggle:hover {
    background: rgba(253, 75, 1, 0.1);
    color: white;
}

.user-menu-toggle i:first-child {
    font-size: 1.2rem;
    color: white;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.user-menu-toggle .user-name-text {
    flex: 1;
    min-width: 0;
    font-size: 0.9rem;
    font-weight: 400;
    color: white;
    line-height: 1.4;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.user-menu-arrow {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    flex-shrink: 0;
    margin-left: auto;
    transition: transform 0.3s;
}

.user-menu-item.active .user-menu-arrow {
    transform: rotate(90deg);
}

.user-menu-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: rgba(0, 0, 0, 0.2);
}

.user-menu-item.active .user-menu-submenu {
    max-height: 200px;
    transition: max-height 0.3s ease-in;
}

.user-menu-submenu li {
    margin: 0;
}

.user-menu-submenu li a {
    padding: 12px 20px 12px 60px;
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.user-menu-submenu li a:hover {
    background: rgba(253, 75, 1, 0.15);
    color: white;
    border-left-color: var(--primary-orange);
    padding-left: 65px;
}

.user-menu-submenu li a i {
    font-size: 1.1rem;
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

.user-menu-submenu li a span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Свернутое состояние меню */
.sidebar.active .user-menu-toggle span,
.sidebar.active .user-menu-arrow {
    display: none;
}

.sidebar.active .user-menu-toggle {
    justify-content: center;
    padding: 15px;
}

.sidebar.active .user-menu-item {
    position: relative;
}

.sidebar.active .user-menu-item.active .user-menu-submenu {
    position: fixed;
    min-width: 200px;
    z-index: 1000;
    box-shadow: 2px 2px 15px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    margin-top: 5px;
}

.sidebar.active .user-menu-submenu li a {
    padding-left: 20px;
    border-radius: 0;
}

.sidebar.active .user-menu-submenu li:first-child a {
    border-radius: 8px 8px 0 0;
}

.sidebar.active .user-menu-submenu li:last-child a {
    border-radius: 0 0 8px 8px;
}

/* ========== Quality Menu Accordion ========== */
.quality-menu-item {
    margin-bottom: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
    margin-bottom: 10px;
}

.quality-menu-toggle {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    border-left: 3px solid transparent;
}

.quality-menu-toggle:hover {
    background: rgba(253, 75, 1, 0.1);
    color: white;
    border-left-color: var(--primary-orange);
}

.quality-menu-item.active > .quality-menu-toggle {
    background: rgba(253, 75, 1, 0.2);
    color: white;
    border-left-color: var(--primary-orange);
}

.quality-menu-toggle i:first-child {
    font-size: 1.3rem;
    margin-right: 15px;
    width: 25px;
    text-align: center;
}

.quality-menu-toggle span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quality-menu-arrow {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    flex-shrink: 0;
    margin-left: auto;
    transition: transform 0.3s;
}

.quality-menu-item.active .quality-menu-arrow {
    transform: rotate(90deg);
}

.quality-menu-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: rgba(0, 0, 0, 0.2);
}

.quality-menu-item.active .quality-menu-submenu {
    max-height: 200px;
    transition: max-height 0.3s ease-in;
}

.quality-menu-submenu li {
    margin: 0;
}

.quality-menu-submenu li a {
    padding: 12px 20px 12px 60px;
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.quality-menu-submenu li a:hover,
.quality-menu-submenu li a.active {
    background: rgba(253, 75, 1, 0.15);
    color: white;
    border-left-color: var(--primary-orange);
    padding-left: 65px;
}

.quality-menu-submenu li a i {
    font-size: 1.1rem;
    margin-right: 12px;
    width: 20px;
    text-align: center;
}

.quality-menu-submenu li a span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Свернутое состояние меню */
.sidebar.active .quality-menu-toggle span,
.sidebar.active .quality-menu-arrow {
    display: none;
}

.sidebar.active .quality-menu-toggle {
    justify-content: center;
    padding: 15px;
}

.sidebar.active .quality-menu-item {
    position: relative;
}

.sidebar.active .quality-menu-item.active .quality-menu-submenu {
    position: fixed;
    min-width: 200px;
    z-index: 1000;
    box-shadow: 2px 2px 15px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    margin-top: 5px;
}

.sidebar.active .quality-menu-submenu li a {
    padding-left: 20px;
    border-radius: 0;
}

.sidebar.active .quality-menu-submenu li:first-child a {
    border-radius: 8px 8px 0 0;
}

.sidebar.active .quality-menu-submenu li:last-child a {
    border-radius: 0 0 8px 8px;
}

/* ========== Content Area ========== */
.content {
    width: calc(100% - 280px);
    margin-left: 280px;
    transition: all 0.3s;
    min-height: 100vh;
}

.sidebar.active ~ .content {
    width: calc(100% - 80px);
    margin-left: 80px;
}

.top-navbar {
    background: white;
    padding: 15px 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 0;
}

.top-navbar .btn-link {
    color: var(--primary-purple);
    font-size: 1.5rem;
    text-decoration: none;
    padding: 5px 10px;
}

.top-navbar .btn-link:hover {
    color: var(--primary-orange);
}

.top-navbar h4 {
    color: var(--secondary-dark);
    font-family: var(--font-body);
    font-weight: 700;
    margin-left: 20px;
}

.main-content {
    padding: 30px;
}

/* ========== Cards ========== */
.card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
    overflow: hidden;
}

.card-header {
    background: linear-gradient(135deg, var(--primary-purple) 0%, var(--primary-orange) 100%);
    color: white;
    padding: 20px 25px;
    border-bottom: none;
}

.card-header .card-title {
    color: white;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 1.25rem;
}

.card-header .card-title i {
    margin-right: 10px;
}

.card-body {
    padding: 25px;
}

/* ========== Stat Cards ========== */
.stat-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    transition: transform 0.3s;
    border-left: 4px solid;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
}

.stat-card-primary {
    border-left-color: var(--primary-orange);
}

.stat-card-success {
    border-left-color: var(--secondary-teal);
}

.stat-card-warning {
    border-left-color: var(--secondary-yellow);
}

.stat-card-info {
    border-left-color: var(--secondary-blue);
}

.stat-icon {
    font-size: 3rem;
    margin-right: 20px;
    opacity: 0.8;
}

.stat-card-primary .stat-icon {
    color: var(--primary-orange);
}

.stat-card-success .stat-icon {
    color: var(--secondary-teal);
}

.stat-card-warning .stat-icon {
    color: var(--secondary-yellow);
}

.stat-card-info .stat-icon {
    color: var(--secondary-blue);
}

.stat-content h3 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--secondary-dark);
}

.stat-content p {
    color: #6c757d;
    margin: 0;
    font-size: 0.9rem;
}

/* ========== Tables ========== */
.table {
    background: white;
}

.table thead th {
    background: #f8f9fa;
    color: var(--secondary-dark);
    font-weight: 600;
    border-bottom: 2px solid var(--primary-orange);
    padding: 15px;
    border: 1px solid #dee2e6;
    vertical-align: middle;
    text-align: center;
}

.table thead th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s;
}

.table thead th.sortable:hover {
    background-color: rgba(253, 75, 1, 0.1);
}

.table thead th.sortable .sort-icon {
    margin-left: 5px;
    font-size: 0.9rem;
    color: var(--primary-orange);
    opacity: 0.5;
    transition: opacity 0.2s;
}

.table thead th.sortable:hover .sort-icon {
    opacity: 1;
}

.table thead th.sortable .sort-icon.bi-arrow-up,
.table thead th.sortable .sort-icon.bi-arrow-down {
    opacity: 1;
    color: var(--primary-orange);
}

/* ========== Pagination ========== */
.pagination-info {
    color: var(--secondary-dark);
    font-size: 0.9rem;
}

.pagination {
    margin: 0;
}

.pagination .page-item .page-link {
    color: var(--primary-orange);
    border-color: #dee2e6;
    padding: 0.5rem 0.75rem;
    transition: all 0.2s;
}

.pagination .page-item .page-link:hover {
    background-color: rgba(253, 75, 1, 0.1);
    border-color: var(--primary-orange);
    color: var(--primary-orange);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-orange);
    border-color: var(--primary-orange);
    color: white;
}

.pagination .page-item.disabled .page-link {
    color: #6c757d;
    pointer-events: none;
    background-color: #fff;
    border-color: #dee2e6;
    opacity: 0.5;
}

.pagination .page-item.disabled .page-link:hover {
    background-color: #fff;
    border-color: #dee2e6;
}

/* ========== Filters ========== */
#filterForm {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #dee2e6;
}

#filterForm .form-label {
    font-weight: 600;
    color: var(--secondary-dark);
    margin-bottom: 8px;
}

#filterForm select[multiple] {
    min-height: 120px;
}

#filterForm .form-text {
    font-size: 0.85rem;
    margin-top: 5px;
    display: block;
}

/* ========== Custom Multiselect ========== */
.custom-multiselect {
    position: relative;
}

.multiselect-input-wrapper {
    position: relative;
}

.multiselect-input-wrapper input {
    cursor: pointer;
    background-color: white;
}

.multiselect-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #6c757d;
    transition: transform 0.2s;
}

.multiselect-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 300px;
    overflow: hidden;
    margin-top: 5px;
}

.custom-multiselect.active .multiselect-dropdown {
    display: block;
}

.custom-multiselect.active .multiselect-arrow {
    transform: translateY(-50%) rotate(180deg);
}

.multiselect-search {
    padding: 10px;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
}

.multiselect-search input {
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.multiselect-options {
    max-height: 250px;
    overflow-y: auto;
    padding: 5px 0;
}

.multiselect-option {
    display: block;
    padding: 10px 15px;
    margin: 0;
    cursor: pointer;
    transition: background-color 0.2s;
    border: none;
}

.multiselect-option:hover {
    background-color: rgba(253, 75, 1, 0.1);
}

.multiselect-option input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: var(--primary-orange);
}

.multiselect-option span {
    user-select: none;
    color: var(--secondary-dark);
}

.multiselect-option input[type="checkbox"]:checked + span {
    font-weight: 600;
    color: var(--primary-orange);
}

/* Стилизация скроллбара */
.multiselect-options::-webkit-scrollbar {
    width: 8px;
}

.multiselect-options::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.multiselect-options::-webkit-scrollbar-thumb {
    background: var(--primary-orange);
    border-radius: 4px;
}

.multiselect-options::-webkit-scrollbar-thumb:hover {
    background: #d63a00;
}

/* ========== Loading Indicator ========== */
#loadingIndicator .spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.table tbody td {
    padding: 15px;
    vertical-align: middle;
    border: 1px solid #dee2e6;
}

.table-bordered {
    border: 1px solid #dee2e6;
}

.table-bordered thead th,
.table-bordered tbody td {
    border: 1px solid #dee2e6;
}

.table-hover tbody tr:hover {
    background-color: rgba(253, 75, 1, 0.05);
}

/* ========== Buttons ========== */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-orange) 0%, var(--primary-purple) 100%);
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-purple) 0%, var(--primary-orange) 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(253, 75, 1, 0.4);
}

.btn-outline-primary {
    border-color: var(--primary-orange);
    color: var(--primary-orange);
}

.btn-outline-primary:hover {
    background: var(--primary-orange);
    border-color: var(--primary-orange);
    color: white;
}

/* ========== Badges ========== */
.badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 500;
}

/* ========== Alerts ========== */
.alert {
    border-radius: 10px;
    border: none;
    margin-bottom: 20px;
}

.alert-success {
    background: rgba(0, 191, 147, 0.1);
    color: #015057;
}

.alert-danger {
    background: rgba(253, 75, 1, 0.1);
    color: #B33A00;
}

.alert-info {
    background: rgba(107, 52, 156, 0.1);
    color: #4B1F6E;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .sidebar {
        margin-left: -280px;
    }
    
    .sidebar.active {
        margin-left: 0;
        min-width: 280px;
        max-width: 280px;
    }
    
    .content {
        width: 100%;
        margin-left: 0;
    }
    
    .sidebar.active ~ .content {
        margin-left: 0;
    }
    
    .stat-card {
        margin-bottom: 20px;
    }
}

