.header {
    height: 60px;
    box-shadow: 0px 4px 4px #0000001f;
    display: flex;
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
    max-width: 1200px;
    border-radius: 10px;
    transition: width 0.1s, height 0.5s, left 0.3s, display 0.3s;
    background-color: #fdfdfd59;
    backdrop-filter: blur(4px);
    z-index: 1000;
}

.header-navbar {
    float: left;
    width: 10%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.header-navbar label {
    font-size: 24px;
    cursor: pointer;
    color: black;
}

#header-navbar-opener{
    display: none;
}

.header-logo {
    width: 80%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.header-logo img {
    width: 135px;
}

.header-buttons {
    float: right;
    width: 10%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.header-buttons a {
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 7px;
    padding: 4px 17px;
    transition: 0.3s all;
    text-decoration: none;
}

.header-buttons a:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translate(-2px, -2px);
    box-shadow: 3px 4px 10px 2px #7f7f7f;
}

.scrolled {
    border-radius: 50% !important;
    width: 50px !important;
    height: 50px !important;
    left: 50px !important;
}

.scrolled .header-logo {
    display: none !important;
}

.scrolled .header-buttons {
    display: none !important;
}

.scrolled .header-navbar {
    width: 100% !important;
}

.navbar-menu {
    position: absolute;
    left: -1000px;
    background-color: var(--primary-color);
    width: 0px;
    top: 20px;
    height: 0px;
    transition: all 0.3s;
    border-radius: 10px;
    /* display: none; */
    transition-property: width, height, left, top;
    /* transition: width 0.3s, height 0.7s, left 0.3s, top 0.7s; */
    transition-duration: 0.3s, 0.7s, 0.3s, 0.7s;
    transition-delay: 0.1s;
    /* overflow: hidden; */
    box-shadow: 0px 0px 10px 2px #a5a2a2;
}

.navbar-label {
    width: 10%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 24px;
}

.navbar-label label {
    cursor: pointer;
}

.navbar-menu ul {
    width: 90%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.navbar-menu ul li {
    list-style: none;
    padding: 0px 20px;
    color: white;
}

.navbar-profile {
    display: none;
}

.navbar-dropdown:hover {
    color: var(--primary-color);
    /* background-color: white; */
}

.navbar-dropdown {
    position: relative;
}

.navbar-dropdown-ul {
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translate(-50%, 0);
    width: auto;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    background: var(--primary-color);
    border-radius: 0 0 10px 10px; /* top corners removed so it visually attaches */
    margin: 0px;
    padding: 8px 0px;
    box-shadow: 0px 8px 18px rgba(0,0,0,0.25);
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    pointer-events: none;
    text-align: center;
    z-index: 9999;
    transition: max-height 260ms cubic-bezier(.2,.9,.2,1), opacity 200ms ease, transform 200ms ease;
}

.navbar-dropdown-ul li {
    list-style: none;
    padding: 10px 18px;
}

.navbar-dropdown-ul li a {
    padding: 6px 16px !important;
    display: block;
}

/* Show dropdown on hover (desktop) or when parent gets .open (JS toggle for mobile) */
/* Only open dropdowns when the parent has the .open class (JS click),
   avoid opening on :hover so desktop hover doesn't trigger visual jumps */
.navbar-dropdown.open > .navbar-dropdown-ul {
    max-height: 999px;
    height: auto;
    opacity: 1;
    transform: translate(-50%, 0);
    pointer-events: auto;
}

/* When parent is hovered/open, remove its bottom radii so dropdown sits flush */
.navbar-dropdown.open > .navbar-dropdown-a {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* Remove hover visual change for dropdown triggers so they don't go white on hover */
.navbar-dropdown > .navbar-dropdown-a:hover {
    background-color: rgba(255,255,255,0.04) !important;
    color: #fff !important;
}

/* In the collapsed/side (scrolled) layout make dropdowns static so they expand inline */
.scrolled .navbar-dropdown-ul {
    position: relative !important;
    display: block;
    transform: none !important;
    left: 0 !important;
    top: auto;
    max-height: 0;
    opacity: 0;
    pointer-events: none;
    box-shadow: none;
    padding: 0;
    border-radius: 10px; /* restore rounded corners in vertical view */
    /* make dropdown full width within the scrolled panel */
    width: 100%;
    margin: 6px 0 0 0;
    text-align: left;
}

.scrolled .navbar-dropdown.open > .navbar-dropdown-ul {
    max-height: 999px;
    opacity: 1;
    pointer-events: auto;
    transform: none !important;
}

/* Tighter spacing for scrolled dropdown items */
.scrolled .navbar-dropdown-ul li {
    padding: 6px 12px !important;
}

.scrolled .navbar-dropdown-ul li a {
    padding: 6px 0 !important;
    color: #fff !important;
    text-align: center !important;
}

/* Prevent hover from turning items black in scrolled view */
.scrolled .navbar-menu ul li a:hover,
.scrolled .navbar-dropdown-ul li a:hover {
    background-color: rgba(255,255,255,0.04) !important;
    color: #fff !important;
}

.navbar-menu ul li a {
    text-decoration: none;
    color: white;
    padding: 10px 18px;
    border-radius: 7px;
    transition: 0.3s all;
}

.navbar-menu ul > li:not(.navbar-dropdown) a:hover {
    background-color: white;
    color: var(--primary-color);
}

#header-navbar-opener:checked ~ .navbar-menu {
    display: flex;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0; 
}

.header-profile {
    border: none !important;
    border-radius: 50% !important;
    padding: 0px !important;
    /* cursor: pointer; */
}

.header-profile:hover {
    transform: none !important;
    box-shadow: 0px 0px 6px 1px #7f7f7f !important;
}

.header-profile img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
}

.header-profile-dropdown {
    position: absolute;
    top: 50px;
    right: 0px;
    background-color: var(--secondary-color);
    border-radius: 10px;
    box-shadow: 0px 0px 10px 2px #a5a2a2;
    overflow: hidden;
    flex-direction: column;
    padding: 10px 0px;
    max-height: 0;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: max-height 260ms cubic-bezier(.2,.9,.2,1), opacity 180ms ease, transform 180ms ease;
}

.header-profile-dropdown ul {
    padding: 0px;
    margin: 0px;
}

.header-profile-dropdown ul li {
    list-style: none;
    padding: 10px 20px;
    text-align: center;
}

.header-profile-dropdown ul li a {
    text-decoration: none;
    color: black;
    transition: 0.2s all;
    border: none;
    padding: 7px 20px;
}

/* Show on hover or when anchor has .open */
.header-profile:hover ~ .header-profile-dropdown,
.header-profile.open ~ .header-profile-dropdown,
.header-profile-dropdown:hover {
    max-height: 420px;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.scrolled .navbar-menu {
    width: 0px;
    height: 0vh;
    /* left: 0px; */
    top: 0px;
    overflow-y: auto;
    margin: 0;
}

.scrolled #header-navbar-opener:checked ~ .navbar-menu {
    width: 200px;
    height: 88vh;
    left: 57px;
    top: 20px;
}

.scrolled .navbar-menu ul {
    width: 99%;
    padding: 0px;
    flex-direction: column;
    margin: 0;
}

.scrolled .navbar-menu ul li {
    padding: 11px 0px;
}

.scrolled .navbar-profile {
    display: block;
}

.scrolled .navbar-label {
    display: none;
}

.scrolled .navbar-dropdown-ul {
    left: 0px;
    top: auto;
}