:root {
    --base-clr: oklch(0.97 0 0);
    --line-clr: oklch(0.922 0 0);
    --hover-clr: oklch(70.143% 0.13815 152.127);
    --text-clr: #000000;
    --accent-clr: oklch(57.81% 0.1776 147.5);
    --accent-clr-hover: white;
    --secondary-text-clr: #b0b3c1;
}

#sidebar {
    height: 100vh;
    box-sizing: border-box;
    width: 250px;
    padding: 5px 1em;
    background-color: var(--base-clr);
    border-right: 1px solid var(--line-clr);

    position: sticky;
    top: 0;
    align-self: start;
    transition: 300ms ease-in-out;
    overflow: hidden;
    text-wrap: nowrap;

    z-index: 10;
}

#sidebar.close {
    padding: 5px;
    width: 60px;
}

#sidebar #toggle-btn {
    margin: 0;
}

#sidebar button {
    box-shadow: none;
}

#sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;

}

/*Style the logo*/
#sidebar > ul > li:first-child {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

#sidebar > ul > li:first-child .logo {
    font-weight: 600;
}

#sidebar > ul > li:last-child {
    margin-top: auto;
}

#sidebar ul li.active a {
    color: var(--accent-clr);
}

#sidebar ul li.active a svg {
    fill: var(--accent-clr);
}

#sidebar ul li.active:hover svg {
    fill: white;
}

#sidebar a, #sidebar .dropdown-btn, #sidebar .logo {
    border-radius: .5em;
    padding: .85em;
    text-decoration: none;
    color: var(--text-clr);
    display: flex;
    align-items: center;
    gap: 1em; 
}

/*To fix the weird behaviour of the first li a item*/
#sidebar a:first-child {
    width: 100%;
    box-sizing: border-box; 
}

.dropdown-btn {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    font: inherit;
    cursor: pointer;
}

#sidebar svg {
    flex-shrink: 0;
    fill: var(--text-clr);
}

/*To make sure the carrat symbol is always moved to the right*/
#sidbar a span, #sidebar .dropdown-btn span {
    flex-grow: 1;
}

#sidebar a:hover, #sidebar .dropdown-btn:hover {
    background-color: var(--hover-clr);
}

/*Min 14 explanation*/
#sidebar .sub-menu {
    display: grid;
    grid-template-rows: 0fr;
    transition: 300ms ease-in-out;
}

#sidebar .sub-menu > div {
    overflow: hidden;
}
/*Adding and removing the class will open and close dropdown menu*/
#sidebar .sub-menu.show {
    grid-template-rows: 1fr;
}

.dropdown-btn svg {
    transition: 200ms ease;
}

.rotate svg:last-child {
    rotate: -180deg;
}

#sidebar .sub-menu a {
    padding-left: 2em;
}

#toggle-btn {
    margin-left: auto;
    padding: 1em;
    border: none;
    border-radius: .5em;
    background: none;
    cursor: pointer;
}

#toggle-btn svg {
    transition: rotate 150ms ease;
}

#toggle-btn:hover {
    background-color: var(--hover-clr);
}

/* Make sure now the CSS will only effect on smaller screens*/
@media(max-width: 800px ) {
    
    body.app-page {
        grid-template-columns: 1fr;

    }

    main {
        padding: 2em 1em 60px 1em;
    }

    .container {
        border: none;
        padding: 0;
    }

    #sidebar {
        height: 60px;
        width: 100%;
        border-radius: none;
        border-top: 1px solid var(--line-clr);
        padding: 0;
        position: fixed;
        top: unset;
        bottom: 0;
    }

    #sidebar > ul {
        padding: 0;
        display: grid;
        grid-auto-columns: 60px;
        grid-auto-flow: column;
        align-items: center;
        overflow-x: scroll;
    }

    #sidebar ul li {
        height: 100%;
    }

    #sidebar ul a, #sidebar ul .dropdown-btn {
        width: 60px;
        height: 60px;
        padding: 0;
        border-radius: 0;
        justify-content: center;
    }

    #sidebar ul li span,
    #sidebar ul li:first-child,
    #sidebar .dropdown-btn svg:last-child {
        display: none;
    }

    #sidebar ul li .sub-menu.show {
        position: fixed;
        bottom: 60px;
        left: 0;
        box-sizing: border-box;
        height: 60px;
        width: 100%;
        background-color: var(--base-clr);
        border-top: 1px solid var(--line-clr);
        display: flex;
        justify-content: center;
    }

    #sidebar ul li .sub-menu.show > div {
        overflow-x: auto;
    }

    #sidebar ul li .sub-menu.show li {
        display: inline-flex;
    }

    #sidebar ul li .sub-menu.show a {
        box-sizing: border-box;
        padding: 1em;
        width: auto;
        justify-content: center;
    }
}