@use '../globals/' as *;
@use '../util/' as *;


$sidebar-width-open:300px;
$sidebar-width-closed:75px;
$sidebar-right-width-open:350px;
$sidebar-right-width-closed:0px;

.sidebar{
    position: fixed;
    padding-inline: 0.75rem;
    height: 100vh;
    width: 100%;
    color: $text-core;
    background: var(--bg-core-primary-light);
    border-right: 1px solid rgba(0,0,0,.025);
    border-radius: $border-radius-lg;
    z-index: $sidebar-zindex;  
    transition: all 0.3s ease;
       
        @include breakpoint(sm) {
            height: 100%;
            position: absolute;
            width: 50%;
        }

        @include breakpoint(md) {
          width: $sidebar-width-open;
      }
        @include breakpoint(xl) {
          height: 100%;
          position: relative;
          border-radius: $border-radius-lg 0 0 $border-radius-lg;
          width: $sidebar-width-open;
      }
}

.sidebar.close{    
    width: 0;
    transform: translateX($sidebar-width-closed);
        @include breakpoint(sm) {
            width: $sidebar-width-closed;
            transform: translateX(0);
            border-radius: $border-radius-lg 0 0 $border-radius-lg;

        }
}


//to do move to core
.main {
    width: calc(100% - 1.5rem) ;
    margin-inline:auto;
    transition: all 0.3s ease;

    @include breakpoint (sm) {
      width: 100%;
      padding: 0 1rem 0 calc($sidebar-width-closed + 1rem);
    }

    @include breakpoint (md) {
      padding: 0 2rem 0 calc($sidebar-width-closed + 2rem);
    }

    @include breakpoint (xl) {
      width: calc(100% - $sidebar-width-open - $sidebar-right-width-open);
      padding: 0 2rem;
    }
  }

  .main.close{
    @include breakpoint (sm) {
      width: 100%;
      padding: 0 1rem 0 calc($sidebar-width-closed + 1rem);

    }

    @include breakpoint (md) {
      padding: 0 2rem 0 calc($sidebar-width-closed + 2rem);
    }
    @include breakpoint (xl) {
      width: calc(100% - $sidebar-width-closed - $sidebar-right-width-open);
      padding: 0 2rem;
    }
  }

  .main.close-r{
    @include breakpoint (sm) {
      width: 100%;
      padding: 0 1rem 0 calc($sidebar-width-closed + 1rem);
    }
    @include breakpoint (md) {
      padding: 0 2rem 0 calc($sidebar-width-closed + 2rem);
    }
    @include breakpoint (xl) {
      width: calc(100% - $sidebar-width-open);
      padding: 0 2rem;
    }
  }

  .main.close.close-r{
    @include breakpoint (sm) {
      width: 100%;
      padding: 0 1rem 0 calc($sidebar-width-closed + 1rem);

    }
    @include breakpoint (md) {
      padding: 0 2rem 0 calc($sidebar-width-closed + 2rem);
    }
    @include breakpoint (xl) {
      width: calc(100% - $sidebar-right-width-closed - $sidebar-width-closed);
      padding: 0 2rem;

    }
  }

.sidebar .sidebar-toggler{
  display: none;
}

.sidebar.close .sidebar-toggler{
  display: block;
  position: absolute;
  right: -63px;
  top: 23px;
  font-size: 1.25rem;
}

// .sidebar.close .sidebar-toggler-close{
//   position: relative;
// }

//profile
.sidebar .profile-details{
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0;
    //color: #fff;
    //background-color: var(--bg-core-primary);
    border-radius: $border-radius-lg 0 0 0;
    transition: all 0.3s ease;
      @include breakpoint (sm) {
        padding-top: 1rem;
      } 
} 

.sidebar .profile-details .avatar{
    min-width: 50px;
    text-align: center;
    margin-right: 12px;
}

.sidebar .profile-details img{
    height: 50px;
    width: 50px;
    object-fit: cover;
    border-radius: 50%;
    padding: 5px;
}

.sidebar .profile-details .profile-description {
  margin-right: auto;
  transition: all 0.3s ease;    

}

  .sidebar .profile-details .profile-name{
    font-weight: 600;
    white-space: nowrap;
    color:var(--text-core-hc)
  }

  .sidebar .profile-details .profile-job{
    font-size: 12px;
    font-weight: 500;
    color:var(--text-core-lc)
  }

  .sidebar .profile-details button{
    align-self: flex-start;
  }

  .sidebar .profile-details i,
  .sidebar .profile-details svg{
    // height: 50px;
    // min-width: 50px;
    // text-align: center;
    // line-height: 50px;
    // font-size: 20px;
    // cursor: pointer;
  }
  .sidebar.close .profile-details i,
  .sidebar.close .profile-details svg,
  .sidebar.close .profile-details button,
  .sidebar.close .profile-details .profile-name,
  .sidebar.close .profile-details .profile-job{
    display: none;
}

  /*NAV*/
  .sidebar nav{
    position: sticky;
    top: 0;
 
}
  

  .sidebar .navbar{
    height: auto;
    //padding: 12px;
    padding: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
  }

  .sidebar.close .navbar{
    overflow: visible;
  }

  .sidebar .navbar::-webkit-scrollbar{
    display: none;
  }
  
  .sidebar .navbar .navbar-header{
    display: block;
    padding: 0.5rem 0;
    margin-bottom: 0;
    font-size: $font-size-sm;
    color: var(--text-core-lc);
    white-space: nowrap;
  }
  

  .sidebar .navbar .navbar-item{
    position: relative;
    list-style: none;
    transition: all 0.4s ease;
    margin-bottom: 12px;
   // line-height: 50px;
    border-radius: $border-radius-pill;
  }

  .sidebar .navbar .navbar-item:hover,
  .sidebar .navbar .navbar-item:active,
  .sidebar .navbar .navbar-item.active{
    background: var(--bg-core-primary-lighten);
  }

  .sidebar.close .navbar .navbar-item{
    border-radius: 50%;
  }

  .sidebar .navbar .navbar-item.fab{
    background-color: var(--accent-color); 
    border-radius: $border-radius-lg;
    margin-bottom: 36px;
    transition: all 0.3s ease;    
  }

  .sidebar .navbar .navbar-item.fab:hover,
  .sidebar .navbar .navbar-item.fab:active,   
  .sidebar .navbar .navbar-item.fab.active{
    background-color: var(--accent-color-hover);
  }

  // .sidebar .navbar .navbar-item i {
  //   height: 50px;
  //   min-width: 50px;
  //   text-align: center;
  //   //line-height: 50px;
  //   color: var(--text-core-lc);
  //   font-size: 22px;
  //   cursor: pointer;
  //   transition: all 0.3s ease;
  // }

  //  .sidebar .navbar .navbar-item svg {
  //   height: 26px;
  //   margin-block: 12px;
  //   min-width: 50px;
  //   text-align: center;
  //   line-height: 50px;
  //   color: var(--text-core-lc);
  //   font-size: 22px;
  //   cursor: pointer;
  //   transition: all 0.3s ease;
  // }
  .sidebar .navbar .navbar-leading-icon{
  display: flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  min-width: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--text-core-lc);
}

.sidebar .navbar .badge-content{
  opacity: 0;
}

.sidebar.close .navbar .badge-content{
  opacity: 1;
  }

  .sidebar .navbar .navbar-item a{
    display: flex;
    align-items: center;
    text-decoration: none;
  }

  .sidebar .navbar .navbar-item a .navbar-link{
    flex: 1 0 auto;
    font-weight: $font-weight-400;
    color: var(--text-core);
  }

  .sidebar .navbar .navbar-item a .navbar-link:first-child {
    padding-left: 1.5rem;
}

  .sidebar.close .navbar .navbar-item a .navbar-link{
    opacity: 0;
    pointer-events: none;
    display: none;
  } 

  .sidebar .navbar .navbar-item a .navbar-link.navbar-link-detail{
    flex: 0 0 auto;
    font-weight: $font-weight-600;
    color: var(--text-core-hc);
    text-align: right;
    padding-right: 1rem;
  }


/*TOOLTIP*/
  // .sidebar.close .navbar .navbar-item .navbar-tooltip{
  //   position: absolute;
  //   background: #fff;
  //   box-shadow: 0 0 2px rgba(0, 0, 0, 0.3);  
  //   width: max-content;
  //   left: calc(100% + 12px);
  //   top: 0;
  //   margin-top: 0;
  //   padding: 10px 20px;
  //   border-radius: $border-radius-lg;
  //   opacity: 0;
  //   display: block;
  //   pointer-events: none;
  //   transition: 0s;
  // }

  // .sidebar.close .navbar .navbar-item:hover .navbar-tooltip{
  //   left: calc(100% + 24px);
  //   opacity: 1;
  //   pointer-events: auto;
  //   transition: all 0.4s ease;
  // }

  // .sidebar.close .navbar .navbar-tooltip {
  //   opacity: 1;
  //   display: block;
  // }

  // .sidebar .navbar .navbar-tooltip {
  //   display: none;
  // }
 


  .sidebar-divider {
    height: 0;
    margin: 0.5rem 0;
    overflow: hidden;
    border-top: 1px solid var(--border-core-lighten);
  }

  

 
/*BOOTOMBAR*/
@include breakpoint-down(sm) { 

    .main {
        margin-bottom: rem(75);
    }

    .sidebar.bottombar,
    .sidebar.close.bottombar {
        position: fixed;
        bottom: 0;
        transform: translateX(0);
        display: flex;
        align-items: center;
        height: rem(75);
        width: 100%;
        color: $text-core;
        background: var(--bg-core-primary-light);
        border-radius: 0;
        z-index: $sidebar-zindex;     
    
    }
    .sidebar.bottombar .profile-description,
    .sidebar.close.bottombar .profile-description,
    .sidebar.bottombar .profile-details i,
    .sidebar.bottombar .profile-details svg,
    .sidebar.bottombar .profile-details button,
    .sidebar.close.bottombar .profile-deteils i,
    .sidebar.close.bottombar .profile-deteils svg,
    .sidebar.close.bottombar .profile-deteils button   {
        display: none; 
    }

    .sidebar.bottombar nav,
    .sidebar.close.bottombar nav {
        position: relative;
        width: 100%; 
 
    }

    .sidebar.bottombar .navbar,
    .sidebar.close.bottombar .navbar {
        padding: 0;
        flex-direction: row; 
        justify-content: space-around;
    }

    .sidebar.bottombar .navbar .navbar-item,
    .sidebar.close.bottombar .navbar .navbar-item {
        margin-bottom: 0;
    }

    .sidebar.bottombar .navbar-link,
    .sidebar.close.bottombar .navbar-link {
        display: none; 
    }

    .sidebar.bottombar .navbar .navbar-item .navbar-tooltip,
    .sidebar.close.bottombar .navbar .navbar-item .navbar-tooltip {
        display: none; 
    }

    .sidebar.bottombar .navbar-item.fab,
    .sidebar.close.bottombar .navbar-item.fab {
        position: absolute;
        right: 1rem;
        top: -4rem; 
    }

    .sidebar.bottombar .sidebar-divider,
    .sidebar.close.bottombar .sidebar-divider {
        display: none; 
    }


}

/*RIGHT SIDEBAR*/


.sidebar.right{
    position: fixed;
    top: 0;
    right: 0;
    height: 100svh;
    width: 100%;
    color: $text-core;
    background: var(--bg-core-primary-lighten);
    border-right: 1px solid rgba(0,0,0,.025);
    border-radius: 0;
    z-index: $sidebar-right-zindex;
    transition: all 0.3s ease;
       
        @include breakpoint(sm) {
            position: absolute;
            height: 100%;
            border-radius: $border-radius-lg;
            width: 50%;
        }

        @include breakpoint(md) {
          width: $sidebar-right-width-open;
      }

        @include breakpoint(xl) {
          height: 100%;
          border-radius: 0 $border-radius-lg $border-radius-lg 0;
          position: relative;
          width: $sidebar-right-width-open;
      }
}

.sidebar.right.close-r{    
    width: 0;
    transform: translateX($sidebar-right-width-closed);
    padding: 0;

        @include breakpoint(sm) {
            width: $sidebar-right-width-closed;
            transform: translateX(0);
            z-index: -1;
            opacity: 0;
            pointer-events: none;
        }
        
}

.sidebar-header{
  padding-top: .75rem;
}

.sidebar.right .navbar .navbar-item:hover,
.sidebar.right .navbar .navbar-item:active,
.sidebar.right .navbar .navbar-item.active{
  background: var(--bg-core-primary);
}





// .scrollable {
//     display: block;
//     height: 100%;
//     max-height: 100vh;
//     min-height: 0;
// }

// .scroll-wrapper {
//     position: relative;
//     width: 100%;
//     height: 100%;
//     background-color: turquoise;
// }
 
//  .scroll-container {
//     position: relative;
//     width: 100%;
//     height: 100%;
//     touch-action: pan-y;
//     overflow-x: hidden;
//     overflow-y: auto;
//  }
 
//  .scroll-content {
//     height: auto;
//     transform: none;
//     position: relative;
//     min-height: 100%;
//  }

.scrollable {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: calc(100vh - 50px);
}

.scroll-wrapper {
    position: relative;
    width: auto;
    height: 100%;
    pointer-events: none;
}
 
 .scroll-container {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;  
    max-height: 100%;
    overflow: hidden;
    pointer-events: auto;
    background-clip: padding-box;

 }
 
 .scroll-content {
    position: relative;
    overflow-y: auto;
    flex: 1 1 auto;

 }