:root {
    --sidebar-width-xl: 280px;     /* 1400px+ */
    --sidebar-width-lg: 260px;     /* 1200px - 1399px */
    --sidebar-width-md: 220px;     /* 1024px - 1199px */
    --sidebar-collapsed-width: 70px;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    background-color: var(--bg-dark);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    transition: width 0.2s ease;
    z-index: 1000;
}

#logo-title.right {
    left: var(--sidebar-width-md);
}

/* Большие экраны 1400px+ */
@media (min-width: 1400px) {
    .sidebar {
        width: var(--sidebar-width-xl);
    }
    .main-content {
        margin-left: var(--sidebar-width-xl);
    }
    #logo-title.right {
        left: var(--sidebar-width-xl);
    }
}

/* Средние-большие экраны 1200px - 1399px */
@media (min-width: 1200px) and (max-width: 1399px) {
    .sidebar {
        width: var(--sidebar-width-lg);
    }
    .main-content {
        margin-left: var(--sidebar-width-lg);
    }
    #logo-title.right {
        left: var(--sidebar-width-lg);
    }
}

/* Средние экраны 1024px - 1199px */
@media (min-width: 1024px) and (max-width: 1199px) {
    .sidebar {
        width: var(--sidebar-width-md);
    }
    .main-content {
        margin-left: var(--sidebar-width-md);
    }
    #logo-title.right {
        left: var(--sidebar-width-md);
    }
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

/* region Потолок бокового меню */

.sidebar-top {
    border-bottom: 1px solid var(--color-border);
}

.the-top {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
}

.sidebar-header {
    justify-content: space-between;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    opacity: 1;
    transition: opacity 0.2s ease;
    cursor: pointer;
}

.sidebar-logo a {
    display: flex;
    align-items: center;
    gap: 8px; /* расстояние между иконкой и текстом */
    text-decoration: none; /* убрать подчеркивание */
}

.logo-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logo-icon:hover {
    transform: scale(1.05);
}

.logo-icon i {
    color: white;
    font-size: 16px;
}

.logo-short-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
}

/* Скрытие короткого названия при сворачивании меню */
.sidebar.collapsed .logo-short-title {
    display: none;
}

/* endregion Потолок бокового меню */

/* region Кнопки сворачивания/разворачивания бокового меню */

.sidebar-toggle-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
    background-color: var(--color-hover);
    color: var(--text-primary);
}

/* endregion Кнопки сворачивания/разворачивания бокового меню */

/* region Основная область бокового меню */

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-item {
    margin-bottom: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    position: relative;
}

.sidebar .nav-link:hover {
    background-color: var(--color-hover);
    color: var(--text-primary);
}

/* region Активность пункта меню */

.nav-link.active,
.profile-nav-container.active .profile-link,
.profile-nav-container.active .logout-btn {
    color: var(--text-primary);
}

.nav-link.active,
.profile-nav-container.active {
    background-color: var(--dark-blue);
}

.logo-icon.active {
    background: var(--blue-gradient);
}

/* endregion Активность пункта меню */

.nav-link i,
.profile-link i {
    width: 20px;
    margin-right: 0.75rem;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}

.nav-text {
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.sidebar.collapsed .nav-text {
    opacity: 0;
}

/* endregion Основное область бокового меню */

/* Подвал меню */
.sidebar-bottom {
    padding: 0.75rem;
    border-top: 1px solid var(--color-border);
}


/* region Подсказки при скрытом меню */

.sidebar.collapsed .nav-link,
.sidebar.collapsed .profile-link,
.sidebar.collapsed .profile-nav-container {
    position: relative;
}

.sidebar.collapsed .nav-link::after,
.sidebar.collapsed .profile-link::after,
.sidebar.collapsed .profile-nav-container::after {
    content: attr(data-title);
    position: absolute;
    left: calc(100% + 0.5rem);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
    font-size: 12px;
}


/* Появление подсказки при наведении на иконку (при скрытом меню) */
.sidebar.collapsed .nav-link:hover::after,
.sidebar.collapsed .profile-link:hover::after,
.sidebar.collapsed .profile-nav-container:hover::after {
    opacity: 1;
}

/* endregion Подсказки при скрытом меню */

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width-md);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-toggle {
        display: block !important;
    }
}

@media (min-width: 769px) {
    .mobile-toggle {
        display: none !important;
    }
}

/* Mobile overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* region Полное название (справа вверху от сайдбара) */

#logo-title {
    position: fixed;
    top: 0;
    left: var(--sidebar-collapsed-width);
    z-index: 1001;
    background: transparent;
    color: var(--text-primary);
    padding: 15px 20px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 500;
    border-left: none;
    transition: left 0.2s ease;
}

/* endregion Полное название (справа вверху от сайдбара )*/


/* Стили для разделенной кнопки профиля */
.profile-nav-container {
    display: flex;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
}

.profile-nav-container:hover {
    background-color: var(--color-hover);
}

.profile-link {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.75rem;
    flex: 1;
    border-radius: 8px 0 0 8px;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.profile-link:hover {
    color: var(--text-primary);
    text-decoration: none;
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.75rem 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20%;
    flex-shrink: 0;
}

.logout-btn:hover {
    background-color: var(--bg-middle);
    color: var(--text-primary);
}

/* Стили для свернутого меню */

.sidebar.collapsed .profile-link {
    justify-content: center;
    border-radius: 8px;
    padding: 0.75rem;
}

.sidebar.collapsed .profile-link .nav-text,
.sidebar.collapsed .logout-btn {
    display: none;
}
