@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-family: Roboto, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.5rem;
}

body {

    background: var(--background);
    color: var(--text-clr);
    transition: background-color 0.4s ease, color 0.4s ease;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: 65px 1fr;
    grid-template-areas: "sidebar header" "sidebar main";
}

header {
    width: 100%;
    position: sticky;
    top: 0;
    border-bottom: 1px solid var(--back-secend);
    grid-area: header;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background-color: var(--base-clr);
}

header .search-trigger {
    background: none;
    border-radius: 1em;
    border: 2px solid var(--line-clr);
    width: 500px;
    height: 35px;
    color: var(--text-clr);
    font-size: 1rem;
}

.search-trigger {
    width: 100%;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: clamp(14px, 2vw, 18px) clamp(16px, 3vw, 24px);
    border: 1px solid rgb(49, 48, 48);
    border-radius: 999px;
    background: none;
    color: #888;
    cursor: text;
    transition: .3s;
}

.search-trigger:hover {
    background: var(--box-main-color);
    color: #fff;
}

.search-trigger .material-symbols-outlined {
    font-size: 22px;
}

.login-user {
    padding: 0.3rem 1.5rem;
    display: flex;
    gap: 0.2rem;
    border-radius: 999px;
    background-color: var(--box-main-color);
}

header div {
    display: flex;
    justify-content: space-between;
    align-items: center;
}


/* === Content === */

main {
    padding: min(30px, 7%);
    grid-area: main;
}


/* === Sidebar === */

#sidebar {
    box-sizing: border-box;
    height: 100vh;
    width: 300px;
    padding: 8px 1em;
    border-right: 1px solid var(--back-secend);
    position: sticky;
    top: 0;
    align-self: start;
    transition: 300ms ease-in-out;
    overflow: hidden;
    text-wrap: nowarp;
    grid-area: sidebar;
    color: var(--text-clr);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    background-color: #333;
}


/* ---- Menu close ---- */

#sidebar.close {
    width: 75px;
}

.close .link-text {
    transition: 400ms ease;
    display: none;
}

.close .menu-close {
    display: none;
}

#sidebar.close>ul>li:first-child .logo {
    display: none;
}

#sidebar.close>ul>li:first-child #toggle-btn {
    display: flex;
    justify-content: center;
}

.close .menu-icon-close:hover {
    background-color: var(--box-main-color);
    transition: 0.5s ease;
}





/* ---- Toggel-btn ----- */

.dropdown-btn.rotate span:last-child {
    rotate: 180deg;
}

#toggle-btn.rotate {
    rotate: 180deg;
}

#toggle-btn {
    margin-left: auto;
    border: none;
    background: none;
    cursor: pointer;
}

#sidebar ul {
    list-style: none;
}

#sidebar>ul>li:first-child {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

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

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

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

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





.dropdown-btn,
.link-text {
    position: relative;
    padding-bottom: 4px;
    display: inline-block;
}

.dropdown-btn::before,
.dropdown-btn::after,
.link-text::before,
.link-text::after {
    content: "";
    position: absolute;
    bottom: 0;
    width: 0;
    height: 2px;
    background: var(--accent-clr);
    transition: width 300ms ease-in;
}

.dropdown-btn::before,
.link-text::before {
    left: 50%;
}

.dropdown-btn::after,
.link-text::after {
    right: 50%;
}

button:hover .dropdown-btn::before,
button:hover .dropdown-btn::after,
a:hover .link-text::before,
a:hover .link-text::after {
    width: 50%;
}





#sidebar .sub-menu {
    display: grid;
    grid-template-rows: 0fr;
    transition: 300ms ease-in-out;

    >div {
        overflow: hidden;
    }
}

#sidebar .sub-menu.show {
    grid-template-rows: 1fr;
}

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

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

@media(max-width: 800px) {
    body {
        grid-template-columns: 1fr;
    }

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

    .line {
        display: none;
    }

    #sidebar {
        height: 60px;
        width: 100%;
        border-right: 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:last-child {
        display: none;
    }

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

    #sidebar ul li .link-text,
    #sidebar ul li:first-child,
    #sidebar .dropdown-btn span:last-child,
    #sidebar .sub-menu-icon {
        display: none;
    }

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

    #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;
    }
}





#menuIcon {
    padding: 0.4rem;
    border-radius: 8px;
}



@media (max-width: 480px) {


    body {
        grid-template-rows: 50px 1fr;
        grid-template-areas:
            "header"
            "main";
    }


    header .search-trigger {
        width: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    header button {
        border: 1px solid var(--line-clr);
        width: 25%;
        height: 30px;
        font-size: 1rem;
    }

    header div h3 {
        padding-left: 0.5rem;
    }

    header div svg {
        width: 25px;
        height: 25px;
    }

    .user-name {
        display: none;
    }

    header h4 {
        display: none;
    }
}