/* Sidebar Styles */
.sidebar {
    min-height: calc(100vh - 76px);
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    border-right: 1px solid #34495e;
    border-bottom: none;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease-in-out;
}

.sidebar .nav-link {
    color: #ecf0f1;
    padding: 0.75rem 1rem;
    margin: 0.1rem 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    border-left: 3px solid transparent;
}

.sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    transform: translateX(5px);
    border-left-color: #3498db;
}

.sidebar .nav-link.active {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    border-left-color: #e74c3c;
}

.sidebar .nav-link .badge {
    font-size: 0.7em;
    margin-left: auto;
}

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
    margin-right: 0.5rem;
}

.sidebar hr {
    margin: 1rem 0.5rem;
    border-color: rgba(255, 255, 255, 0.2);
    opacity: 0.5;
}

.sidebar .text-muted {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #ffffff !important;
}

.sidebar-heading {
    font-size: .75rem;
    text-transform: uppercase;
}

.sidebar .nav-item.mt-3 {
    margin-top: 1.5rem !important;
}

.sidebar .position-sticky {
    padding-top: 1rem !important;
}

/* Custom Sidebar Styles */
.custom-sidebar {
    min-height: calc(100vh - 76px);
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%) !important;
    border-right: 1px solid #34495e !important;
    border-bottom: none !important;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3) !important;
    padding: 0 !important;
}

.custom-sidebar .nav-link {
    color: #ecf0f1 !important;
    padding: 0.75rem 1rem !important;
    margin: 0.1rem 0.5rem !important;
    border-radius: 0.375rem !important;
    transition: all 0.2s ease-in-out !important;
    display: flex !important;
    align-items: center !important;
    text-decoration: none !important;
    border-left: 3px solid transparent !important;
}

.custom-sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
    transform: translateX(5px) !important;
    border-left-color: #3498db !important;
}

.custom-sidebar .nav-link.active {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3) !important;
    border-left-color: #e74c3c !important;
}

.custom-sidebar .nav-link .badge {
    font-size: 0.7em !important;
    margin-left: auto !important;
}

.custom-sidebar .nav-link i {
    width: 20px !important;
    text-align: center !important;
    margin-right: 0.5rem !important;
}

.custom-sidebar hr {
    margin: 1rem 0.5rem !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    opacity: 0.5 !important;
}

.custom-sidebar .text-muted {
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    color: #ffffff !important;
}

.custom-sidebar .nav-item.mt-3 {
    margin-top: 1.5rem !important;
}

.custom-sidebar .position-sticky {
    padding-top: 1rem !important;
}

nav.custom-sidebar {
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%) !important;
}

nav.custom-sidebar .nav-link {
    color: #ecf0f1 !important;
}

/* Overlay для мобильного меню */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1029;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* Responsive */
@media (max-width: 767.98px) {
    /* Скрываем сайдбар на мобильных по умолчанию */
    .custom-sidebar {
        position: fixed !important;
        top: 76px !important;
        left: 0 !important;
        z-index: 1031 !important; /* Выше overlay (1029) */
        width: 280px !important;
        max-width: 280px !important;
        height: calc(100vh - 76px) !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s ease-in-out !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        /* Переопределяем классы Bootstrap col-* на мобильных */
        flex: none !important;
        width: 280px !important;
        max-width: 280px !important;
        margin: 0 !important;
        padding: 0 !important;
        /* Убеждаемся, что элемент виден */
        pointer-events: auto !important;
    }
    
    .custom-sidebar.mobile-show {
        transform: translateX(0) !important;
        left: 0 !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 1031 !important;
    }
    
    /* Дополнительное правило для гарантии видимости */
    .custom-sidebar.mobile-show[style*="transform"] {
        transform: translateX(0) !important;
    }
    
    .custom-sidebar .nav-link {
        margin: 0.1rem 0.75rem !important;
    }
    
    /* Основной контент занимает всю ширину на мобильных */
    main.main-content {
        width: 100% !important;
        margin-left: 0 !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    
    /* Убираем отступы контейнера на мобильных */
    .container-fluid .row {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* На десктопе сайдбар всегда виден */
@media (min-width: 768px) {
    .custom-sidebar {
        display: block !important;
        position: relative !important;
        transform: none !important;
        width: auto !important;
        max-width: none !important;
        height: auto !important;
        top: auto !important;
        left: auto !important;
        flex: 0 0 25% !important; /* col-md-3 = 25% */
    }
    
    main.main-content {
        flex: 0 0 75% !important; /* col-md-9 = 75% */
        max-width: 75% !important;
    }
    
    .sidebar-overlay {
        display: none !important;
    }
}

@media (min-width: 992px) {
    .custom-sidebar {
        flex: 0 0 16.666667% !important; /* col-lg-2 = 16.67% */
    }
    
    main.main-content {
        flex: 0 0 83.333333% !important; /* col-lg-10 = 83.33% */
        max-width: 83.333333% !important;
    }
}

