#bodyContainer {
  display: grid;
  grid-template-areas:
   "header header"
   "sidebar content";
  grid-template-columns: auto 1fr;
  grid-template-rows: 2.5rem 1fr;
  height: 100vh;
  overflow: hidden;

}

#pageHeader {
  grid-area: header;
  position: sticky;
  position: relative;
  top: 0;
  z-index: 19000;
  background-color: white;
}


    /* ---------------------------------------------- */
    /* ------------------- navbar ------------------- */
    /* ---------------------------------------------- */

    #nav, .navbar, #logoName, .icons {
        display: flex;
        align-items: center;
        
        
    }

    body {
        height: 100%;
        margin: 0;
        overflow-y: auto;
    }






    #nav {
        height: 100%;
        width: 100%;

        z-index: 20;
    

        padding: 0rem 2rem;
        justify-content: space-between;
        color: var(--blue-color);
        background-color: white;
        background-color: var(--blue-color);


        transition: 0.5s;
    }


    .navbar {
        color: var(--blue-color);
        background-color: inherit;
    }

    a {
        padding: 0.5rem 1vw;
        color: var(--blue-color);                                                 
    }

  
    /* ---------------- logo section ---------------- */

    #logoSection {
        flex: 1 1 40%;
    }

    #logoSection > a {
        padding: 0 1rem 0 0;
    }

    #companyLogo {
        background-color: white;
        display: block;

        width: 1.8rem;
        transition: 0.5s;

    }


    #logoSection > a {
    display: flex;
    align-items: center;
    gap: 0.5rem; /* space between logo and text */
    padding: 0 1rem 0 0;
}
#companyLogo {
    display: inline-block; /* no forced line break */
}


    .orangeLogo {
        fill: var(--orange-color);


    } 
  
    .blueLogo {
        fill: var(--blue-color);

    }

    #companyName {
        font-size: 1.5rem;

        font-family: Arial, Helvetica, sans-serif;
        transition: 0.5s;
        color: white;
   

    }

    /* ---------------- page section ---------------- */

    #pageSection {
        margin-right: 4vw;
    }

    #pageSection > a {
        font-size: 1.2rem;
    }

    #pageSection a:is(:visited, :link, :active).active {
        color:var(--orange-color)
    }

    #pageSection a:hover{
        color: var(--blue-color);
        text-decoration: underline;
        text-decoration-color: var(--orange-color);
    }

    /* ---------------- icon section ---------------- */
  
    #iconSection{
      gap: 1em;
    }

    #flexContainer {
        width: 70%;
        background-color: black;
        margin: 5% 15%;
        display: flex;
        flex-wrap: wrap;
        flex-direction: row;
        gap: 5px;
        padding: 5px;

    }

    .flexItem {
        height: 200px;
        flex: 1 0 0;
        background-color: aqua;

    }

    #menuItems {
        overflow: hidden;
        max-height: 0;
        transition: max-height 0.2s ease-in-out;
        background-color: var(--blue-color);
        width: 100%;
        position: absolute;
        top: 100%;
        z-index: 19000;

    }
    
    #menuItems.menu-active {
        max-height: 600px; /* big enough to contain all items */
        box-shadow: rgba(0, 0, 0, 0.1) 0px 5px 8px 0px, rgba(0, 0, 0, 0.08) 0px 3px 10px 0px;

    }
    
    #menuItemsList {
        display: flex;
        flex-wrap: wrap;
        gap: 0em;
        padding: 0px;
        list-style: none;
        margin: 0;
    }
    
    #menuItemsList li.menuItemsLinks {
        flex: 1 0 0;
        height: 200px;
        position: relative;
        overflow: hidden;
        margin: 0;
    }



    
    .menuCard {
        position: absolute;
        inset: 0;
        background-color: var(--blue-color);
        display: grid;
        place-content: center;
        cursor: pointer;
        transform: translateX(0);
        transform: translateY(0);
        transition: transform 0s ease-in-out;
        font-weight: bold;
        font-size: 1.2rem;
        z-index: 2;
    }
    
    .menuCardList {
        position: absolute;
        inset: 0;
        padding: 2.5rem;
        background-color: var(--blue-color);
        background-color: rgb(72, 72, 138);
        background-color: #ddd;
        color: var(--blue-color);
        width: 100%;

        list-style: none;
        display: flex;
        flex-direction: column;
        flex-wrap: wrap;
        gap: 1.5rem;
        overflow-y: auto;
        z-index: 1;

    }

    .menuCardList li {
      flex: 0 0 auto;
    }

    .menuCardList a:hover {
      text-decoration: underline;
      text-decoration-color: var(--orange-color);
      text-decoration-thickness: 2px;
    
    }

    .menuCardList a {
        width: 100%;
        height: 3rem;
    }
    
    .menuItemsLinks:hover .menuCard,
    .menuItemsLinks:focus-within .menuCard {
        transform: translateX(-100%);
        transform: translateY(200%);
    }
    

    /* --------------- Hamburger menu --------------- */

    #menu {
        display: flex;
        position: relative;
        padding: 1rem 1.7vw;
        cursor: pointer;

    }

    #menu:hover b{
        background-color: var(--orange-color);
    }


    .McButton {
      position: absolute;
      margin-left: -0.6em;
      margin-top: -0.4em;
      width: 1.2em;
      height: 0.8em;
      cursor: pointer;
    }

    .McButton b {
      position: absolute;
      left: 0;
      width: 1.2em;
      height: 0.1em;
      background-color: white;
    }

    .McButton b:nth-child(1) {
       top: 0;
    }

    .McButton b:nth-child(2) {
       top: 50%;
    }

    .McButton b:nth-child(3) {
      top: 100%;
    }


    /* colapse menu to bar*/
    @keyframes collapse1 {from {top: 0%;}to {top: 50%;}} 
    @keyframes collapse3 {from {top: 100%;}to {top: 50%;}}

    /* make an X */ 
    @keyframes rotateButton {from{transform:rotate(0deg);}to{transform:rotate(135deg);}}
    @keyframes rotate3 {from{transform:rotate(0deg); top:50%}to{transform: rotate(90deg); top:50%;}}

    /* colapse the X */ 
    @keyframes rotateButtonBack {from{transform: rotate(135deg);}to{transform: rotate(180deg);}}
    @keyframes rotate3Back {from{transform:rotate(90deg); top:50%}to{transform:rotate(0deg); top:50%}}

    /* expand back to menu */ 
    @keyframes expand1 {from {top: 50%; }to {top: 0%;}} 
    @keyframes expand3 {from {top:50%;}to {top: 100%;}}


     /* --------------- Language menu --------------- */

    /* Base styles for the avatar button */
    #language .avatar,
    #avatar-btn { /* either selector works; the ID is most specific */
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 1.6rem;
      height: 1.6rem;
      border-radius: 9999px;
      border: 0;
      font-weight: 400;
      background: var(--blue-color, #3b82f6);
      color: #fff;
      cursor: pointer;
      transition: background-color .2s ease, color .2s ease, transform .1s ease;
      border: 1px solid white;
      font-size: 0.7em;
    }

    /* Hover/focus styles */
    #language:hover .avatar,
    #language .avatar:focus-visible {
      border: 1px solid var(--orange-color);
      color: var(--orange-color);
    }




    /* --------------- media queries ---------------- */
    
    @media screen and (max-width: 1000px){

        #nav {
            height: 2.6rem;
            padding: 0rem 1.5rem;
        }

        #pageSection a {
            display: none;
        }

        #companyLogo {
            width: 1.8rem;
            height: 1.8rem;
        }

        #logoSection > a {
        padding: 0 0.5rem 0 0;
        }

        #companyName {
            font-size: 1.3rem;
        }
        

        .navButton {
            padding-left: 0.5rem;
        }

        #signUp {
            display: none;
        }
    }



/* ---------  sidebar section   ---------- */


#pageSidebar {
  grid-area: sidebar;
  width: 6rem;
  transition: width 0.3s ease;
  background-color: #f9f9f9;
  color: black;
  z-index: 10;

}

#bodyContainer.sidebarCollapsed #pageSidebar {
  width: 6rem;
}

#bodyContainer.sidebarExpanded #pageSidebar {
  width: 25rem;
}

#sidebarFlexContainer {
  position: sticky;
  top: 2.5rem;
  display:flex;
  flex-direction: column; 
  overflow: hidden;
}

#sidebarToggle {
  cursor: pointer;
  border: 0;
  padding: 2em;
  background-color: inherit;

}

#searchSettingsButton {
  height: 3em;
  width: 3em;
  border-radius: 3em;
  background-color: white;
  box-shadow: 0 6px 12px #00000033;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: margin-left 0.3s ease;
  color: #424242;
}

#bodyContainer.sidebarExpanded #searchSettingsButton {
    margin-left: 19rem;
    color: var(--orange-color);
}

#searchSettingsButton:hover {
    color: var(--orange-color)
}

.rotate-cw {
  animation: rotateClockwise 0.4s;
}

.rotate-ccw {
  animation: rotateCounterClockwise 0.4s;
}

@keyframes rotateClockwise {
  from { transform: rotate(0deg); }
  to { transform: rotate(180deg); }
}

@keyframes rotateCounterClockwise {
  from { transform: rotate(180deg); }
  to { transform: rotate(0deg); }
}

#sidebarSettingsUl {
  padding-inline-start: 0;
  margin: 0;
  padding-top: 3rem;
}

#sidebarSettingsUl li {
  list-style: none;
  padding: 0.75rem 2.5rem;
  display: flex;
  cursor: pointer;
}

#sidebarSettingsUl li.expanded {
  background-color: #eaeaea;
}

.sidebarSettingsPannel {
  transition: height 0.2s ease, opacity 0.2s ease;
  height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

#sidebarSettingsUl li.expanded .sidebarSettingsPannel {
  height: 50vh; 
  background-color: #f9f9f9;
  margin: 0 0 0 1em;
  padding: 1rem 0;
  opacity: 1;
  pointer-events: auto;
}

#indexToggle {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

#indexToggle .index-chip {
  border: 1px solid #d0d5dd;
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  background-color: white;
  color: #2d3748;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  text-transform: none;
  line-height: 1.2;
}

#indexToggle .index-chip:hover {
  background-color: rgba(0, 0, 0, 0.04);
}

#indexToggle .index-chip.is-active {
  background-color: rgba(15, 76, 129, 0.15);
  color: var(--blue-color, #0f4c81);
  border-color: var(--blue-color, #0f4c81);
}

#sidebarSettingsUl li:hover {
  background-color: #eaeaea;
}

#sidebarSettings li span {
  margin-left: 0.75rem;
  display: none;
}

#bodyContainer.sidebarExpanded li span {
  display: inline-block
}

#bodyContainer.sidebarCollapsed li span {
  display: none;
}

#sidebarSettingsUl li {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0; 
}

#sidebarSettingsUl li button {
  white-space: nowrap;
  padding: 0.75rem 2.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3rem;
  min-width: 100%;
  width: 100%;
  background: none;
  border: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-radius: 1em;
}

#sidebarSettingsUl li button svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

/* --------- table / main content section   ---------- */

#pageContent {
  grid-area: content;
  background-color: white; 
  height: 200vh;
  z-index: 1;
}

@media screen and (max-width: 1000px){
  /* --------- sidebar section for mobile   ---------- */
  body, html {
    overflow: hidden;
    height: 100vh;
  }
  
  #bodyContainer.sidebarCollapsed #pageSidebar {
    width: 0rem;
    overflow: hidden;
  }
  
  #bodyContainer.sidebarExpanded #pageSidebar {
    width: 100vw;
    height: calc(100vh - 2.5rem);
    overflow-y: auto;
  }

  #sidebarToggle {
    position: fixed;
    bottom: 2rem;
    right: 1rem;
    padding: 0;
    border-radius: 3rem;

  } 


   
}
