.sidebar-tools {
    --main-color: #3b82f6;  
    --hover-color: #1e40af;
    --background-color: #f3f4f6;
    --icon-size: 24px;
    position: fixed;
    left: 0;
    top: 250px;
    display: flex;
    flex-direction: column;
    width: calc(var(--icon-size) + 16px);
    overflow: hidden;
    background-color: var(--background-color);
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    z-index: 1000;
    transition: width 0.3s ease-in-out, max-height 0.3s ease-in-out;
    max-height: calc( (4 * 56px) + 40px ); /* 4 pozycje * wysokość pozycji + wysokość nagłówka */
}

.sidebar-tools:hover {
    width: 250px;
    max-height: 1000px; /* Wystarczająco duża wartość, aby pomieścić wszystkie pozycje */
}

.sidebar-header {
    height: 0;
    overflow: hidden;
    transition: height 0.3s ease-in-out;
}

.sidebar-tools:hover .sidebar-header {
    height: 40px;
}

.sidebar-title {
    text-align: center;
    padding: 12px 16px;
    font-weight: bold;
    color: #C50000;
    white-space: nowrap;
    background-color: var(--background-color);
    margin: 0;
    font-size: 20px;
    opacity: 0; /* Dodane, aby tytuł był ukryty początkowo */
    transition: opacity 0.3s ease-in-out;
}

.sidebar-tools:hover .sidebar-title {
    opacity: 1; /* Tytuł pojawia się po najechaniu */
}

.tool-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

.tool-item {
    display: flex;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid #d1d5db;
}

.tool-item:last-child {
    border-bottom: none;
}

.tool-link {
    text-decoration: none;
    color: var(--main-color);
    display: flex;
    align-items: center;
    width: 100%;
    padding: 8px;
    transition: color 0.2s ease-in-out, background-color 0.2s ease-in-out;
}

.tool-link:hover,
.tool-link.active {
    color: var(--hover-color);
    background-color: rgba(231, 231, 231, 0.4);
}

.tool-icon {
    width: var(--icon-size);
    height: var(--icon-size);
    margin-right: 12px;
    flex-shrink: 0;
}

.tool-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
    transition: fill 0.2s ease-in-out;
}

.tool-name {
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    padding-right: 16px;
}

.sidebar-tools:hover .tool-name {
    opacity: 1;
}

/* Stylizacja dla ukrytych pozycji */
.hidden-tools {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
}

.sidebar-tools:hover .hidden-tools {
    max-height: 1000px; /* Wystarczająco duża wartość, aby pomieścić wszystkie pozycje */
}

/* Dostosowanie do urządzeń mobilnych */
@media screen and (max-width: 768px) {
    .sidebar-tools {
        top: auto;
        bottom: 0;
        width: 100%;
        height: auto;
        flex-direction: row;
        justify-content: space-around;
        max-height: none; /* Usuń ograniczenie wysokości na urządzeniach mobilnych */
        display: none;
    }

    .sidebar-tools:hover {
        width: 100%;
    }

    .sidebar-header {
        display: none;
    }

    .sidebar-title {
        text-align: center;
        padding: 12px 16px;
        font-weight: bold;
        color: #C50000;
        white-space: nowrap;
        background-color: var(--background-color);
        margin: 0;
        font-size: 20px;
        opacity: 0; /* Dodane, aby tytuł był ukryty początkowo */
        transition: opacity 0.3s ease-in-out;
    
    }

    .tool-list {
        display: flex;
        justify-content: space-around;
        overflow: visible; /* Pozwól, aby wszystkie pozycje były widoczne */
    }

    .tool-item {
        border-bottom: none;
        flex: 1;
    }

    .tool-link {
        flex-direction: column;
        align-items: center;
        padding: 8px 4px;
    }

    .tool-icon {
        margin-right: 0;
        margin-bottom: 4px;
    }

    .tool-name {
        font-size: 12px;
        opacity: 1;
        padding-right: 0;
    }

    /* Pokaż wszystkie pozycje na urządzeniach mobilnych */
    .hidden-tools {
        max-height: none;
    }

    .sidebar-tools:hover .hidden-tools {
        max-height: none;
    }
}
