@import url('http://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Poppins", sans-serif;
}

:root{
    --base-clr: #1f242d;
    --line-clr: #42434a;
    --hover-clr: #292e42;
    --text-clr: #e6e6ef;
    --accent-clr: #5e63ff;
    --secondary-text-clr: #b0b3c1;
}

body{
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--base-clr);
    color: #fff;
    display: grid;
    grid-template-columns: auto 1fr;
    padding-top: 80px; /* 与 header 的高度一致 */
}

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

    position: sticky;
    top: 100px;
    align-self: start; 
    transition: 300ms ease-in-out;
    overflow: hidden;
    text-wrap: nowrap;
}
#sidebar.close{
    padding: 5px;
    width: 60px;
}

#sidebar ul{
    list-style: none;
}

#sidebar > ul > li:first-child{
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
    .logo1{
        font-weight: 600;
    }
}
#sidebar ul li.active a, #sidebar ul li button.active{
    color: var(--accent-clr);

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

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

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

#sidebar a span, #sidebar .dropdown-btn span{
    flex-grow: 1;
} 

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

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

    svg{
        transition: rotate 150ms ease;
    }
}

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


.scroll-target {
    scroll-margin-top: 80px; /* Offset scroll position by 80px */
}



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

main p{
    color: var(--secondary-text-clr);
    margin-top:  5px;
    margin-bottom: 15px;
}

.container{
    border: 1px solid var(--line-clr);
    border-radius: 1em;
    margin-bottom: 20px;
    padding: min(3em, 15%);

    h2, p { margin-top: 1em}
} 

/* Header styling */
.header {
    grid-column: span 2; /* Make the header span both columns */
    position: fixed; /* Keeps it fixed at the top of the viewport */
    top: 0;
    left: 0;
    width: 100%; /* Ensures it spans the entire width */
    background: #1f242d;
    z-index: 100; /* Ensures it stays above other elements */
    padding: 20px 10%;
    box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1); 
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo{
    font-size: 25px;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    cursor: default;
    opacity: 0;
    animation: slideRight 1s ease forwards;
}

.navbar a{
    display: inline-block;
    font-size: 18px;
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    margin-left: 35px;
    opacity: 0;
    transition: 0.3s;
    animation: slideUp 1s ease forwards;
    animation-delay: calc(0.2s * var(--i));
}

.navbar a:hover,
.navbar a.active{
    color: #6f63d4;
}

@keyframes slideUp{
    0%{
        transform: translateY(100px);
    }

    100%{
        transform: translateY(0);
        opacity: 1;
    }

}

@keyframes slideRight {
    0%{
        transform: translateX(-100px);
    }

    100%{
        transform: translateX(0);
        opacity: 1;
    }
}

@media screen and (max-width: 800px){
    body{
        grid-template-columns: 1fr;
    }
    main{
        padding: 2em 1em 60px 1em;
    }
    .container{
        border: none;
        padding: 0;
    }
    #sidebar{
        height: 60px;
        width: 100%;
        border-right: none;
        border-top: 1px solid var(--line-clr);
        padding: 0;
        position: fixed;
        top: unset;
        bottom: 0;

        >ul{
            padding: 0;
            display: grid;
            grid-auto-columns: 60px;
            grid-auto-flow: column;
            align-items: center;
            overflow-x: scroll;
            justify-content: center;
        }
        ul li{
            height: 100%;
        }
        ul a, ul .dropdown-btn{
            width: 60px;
            height: 60px;
            padding: 0;
            border-radius: 0;
            justify-content: center;
        }

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

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

            >div{
                overflow-x: auto;
            }
            li{
                display: inline-flex;
            }
            a{
                box-sizing: border-box;
                padding: 1em;
                width: auto;
                justify-content: center;
            }
        }
    }
}
/*========== SCROLL BAR ==========*/
::-webkit-scrollbar {
    width: .60rem;
    background-color: var(--base-clr);
    border-radius: .5rem;
  }
  
  ::-webkit-scrollbar-thumb {
    background-color: var(--line-clr);
    border-radius: .5rem;
  }
  
  ::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-clr);
  }

  @media screen and (max-width: 795px) {
    .home-content h1 {
        display: none;
    }

    .logo {
        display: none; /* Hide logo */
    }
    .navbar {
        margin-left: -55px;
        display: flex; /* 使用 Flexbox 布局 */
        justify-content: space-between; /* 等距分布链接 */
        width: 100%; /* 占满顶部宽度 */
        padding: 0; /* 去掉额外的内边距 */
    }
}