/* Контейнер серверов */
.server-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 72px;
    height: 100vh;
    background-color: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    z-index: 9;
    overflow-y: auto;
    scrollbar-width: none;
    padding-bottom: 70px;
    gap: 8px;
}

#servers-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 8px;
}

/* Главный контейнер приложения с серверной панелью */
.app-with-servers {
    display: flex;
    min-height: 100vh;
    margin-left: 72px;
}

/* Основное содержимое смещается при наличии серверной панели */
.app-with-servers>aside.sidebar {
    margin-left: 0;
}

/* Прокрутка серверов */
.server-sidebar::-webkit-scrollbar {
    width: 0;
    background: transparent;
}

/* Сервер (круглая иконка) */
.server-item {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--background-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-radius 0.2s, background-color 0.2s;
    margin-bottom: 0;
    flex-shrink: 0;
}

.server-item:hover {
    border-radius: 16px;
    background-color: var(--brand-experiment);
}

.server-item:hover img {
    border-radius: 16px;
}

.server-item.active {
    border-radius: 16px;
    background-color: var(--brand-experiment);
}

.server-item.active img {
    border-radius: 16px;
}

/* Индикатор активного сервера */
.server-item::before {
    content: '';
    position: absolute;
    left: -12px;
    /* Чуть ближе к краю, чтобы было видно при наведении */
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 0;
    background-color: var(--text-primary);
    border-radius: 0 4px 4px 0;
    transition: height 0.2s
}

.server-item.active::before {
    height: 40px;
}

.server-item.unread::before {
    height: 8px;
}

.server-item:hover::before {
    height: 20px;
}

.server-item.active.unread::before,
.server-item.active:hover::before {
    height: 40px;
}

/* Muted state for the indicator */
.server-item.muted.unread::before {
    opacity: 0.5;
}

/* Аватар сервера */
.server-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    overflow: hidden;
    transition: border-radius 0.2s, background-color 0.2s;
    /* Переносим сюда */
}

/* Иконка сервера (если нет аватара) */
.server-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    color: var(--text-normal);
    font-weight: 600;
    font-size: 12px;
    transition: color 0.2s;
}

.server-item svg.server-icon {
    width: 28px;
    height: 28px;
}

.server-item:hover .server-icon {
    color: white;
}

.server-item.active .server-icon {
    color: white;
}

/* Разделитель */
.server-divider {
    width: 32px;
    height: 2px;
    background-color: var(--background-modifier-accent);
    border-radius: 1px;
    margin: 8px 0;
    flex-shrink: 0;
}

/* Кнопка добавления сервера */
.add-server-btn {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--background-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    border: none;
    padding: 0;
}

.add-server-btn img {
    width: 20px;
    height: 20px;
    filter: brightness(0.7);
    transition: filter 0.2s ease;
}

.add-server-btn:hover {
    border-radius: 16px;
    background-color: var(--success);
}

.add-server-btn:hover img {
    filter: brightness(1);
}

/* Кнопка открытия страницы серверов */
.discover-servers-btn {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--background-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-normal);
    flex-shrink: 0;
    border: none;
    padding: 0;
}

.discover-servers-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.discover-servers-btn:hover {
    border-radius: 16px;
    background-color: var(--brand-experiment);
    color: white;
}

/* Бейдж с уведомлениями */
.server-notification-badge {
    position: absolute;
    bottom: -6px;
    right: -6px;
    background-color: var(--status-danger);
    color: white;
    font-size: 12px;
    font-weight: 700;
    min-width: 16px;
    height: 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 5px solid var(--bg-sidebar);
    z-index: 1;
}

.server-item.muted .server-notification-badge {
    background-color: var(--offline);
}

/* Анимация загрузки серверов */
@keyframes serverItemAppear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.server-item {
    animation: serverItemAppear 0.2s ease-out;
}

/* Общий тултип для сайдбара */
.server-sidebar-tooltip {
    position: fixed;
    background-color: var(--background-lighting);
    color: var(--text-normal);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    pointer-events: none;
    z-index: 10000;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    box-shadow: var(--shadow-tooltip);
    border: 1px solid var(--background-modifier-hover);
}

.server-sidebar-tooltip.visible {
    opacity: 1;
    transform: translateX(0);
}

.server-sidebar-tooltip::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 50%;
    transform: translateY(-50%);
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-right: 5px solid var(--background-lighting);
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .server-sidebar {
        z-index: 50;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 4px;
        width: 60px;
    }

    .app-with-servers {
        margin-left: 0;
        margin-bottom: 72px;
    }

    .server-item {
        margin-bottom: 0;
        margin-right: 0;
        flex-shrink: 0;
    }
}