// Sidebar Base

// Variables
$primaryColor: #4285f4 !default;
$baseBg: #2a2a2e !default;
$darkenBg: darken($baseBg, 5%) !default;
$lightenBg: lighten($baseBg, 5%) !default;

$itemColor: #fff !default;

$itemOpenColor: #fff !default;
$itemOpenBg: $primaryColor !default;

$itemHoverColor: #fff !default;
$itemHoverBg: rgba($darkenBg, 0.5) !default;

$iconColor: #fff !default;
$iconBg: $darkenBg !default;

$iconActiveColor: #fff !default;
$iconActiveBg: $darkenBg !default;

$iconOpenColor: #fff !default;
$iconOpenBg: transparent !default;

$mobileItemColor: #fff !default;
$mobileItemBg: $primaryColor !default;
$mobileIconBg: transparent !default;
$mobileIconColor: #fff !default;

$dropDownColor: #fff !default;
$dropDownBg: $lightenBg !default;
$sidebar-box-shadow: 7px 0 60px rgba(0, 0, 0, 0.05);

.app-sidebar {
  display: flex;
  z-index: 20;
  overflow: hidden;
  width: $app-sidebar-width;
  position: fixed;
  height: 100vh;
  box-shadow: $sidebar-box-shadow;
  flex-direction: column;
  transition: width .3s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important, 
              transform .3s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important,
              box-shadow .3s ease !important;
  
  .sidebar-scrollbar {
    overflow-y: auto;
    height: 100%;
    
    &::-webkit-scrollbar {
      width: 6px;
    }
    
    &::-webkit-scrollbar-track {
      background: rgba(0, 0, 0, 0.1);
    }
    
    &::-webkit-scrollbar-thumb {
      background: rgba(0, 0, 0, 0.3);
      border-radius: 3px;
    }
    
    &::-webkit-scrollbar-thumb:hover {
      background: rgba(0, 0, 0, 0.5);
    }
  }

  .app-header__logo {
    padding: 0 $layout-spacer-x;
    height: $app-header-height;
    width: $app-sidebar-width;
    display: flex;
    align-items: center;
    transition: width .3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                padding .3s ease;
    flex-shrink: 0;
  }

  .app-sidebar-content {
    flex-grow: 1;
    display: flex;
    width: 100%;

    .app-sidebar-scroll {
      width: 100%;
      height: 100%;
    }
  }

  .accordion .card {
    box-shadow: 0 0 0 0 transparent;
    border: 0;
    background: transparent;
    position: relative;
    display: block;
    padding: 0.1rem 0;

    .card-body {
      padding: 0;
    }

    .card-header {
      padding: 0;
      margin: 0;
      @include border-radius(0);
      border: 0;
      height: auto;
      background: transparent;
    }
  }
}

.logo-src {
  height: $logo-height;
  width: $logo-width;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  transition: width .3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  
  .logo-text {
    font-size: 20px;
    font-weight: 700;
    color: #3f6ad8;
    white-space: nowrap;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    transition: transform .3s ease;
    
    .logo-full {
      display: block;
      opacity: 1;
      transition: opacity .3s ease, transform .3s ease;
    }
    
    .logo-collapsed {
      display: none;
      font-size: 24px;
      font-weight: 800;
      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      opacity: 0;
      transition: opacity .3s ease, transform .3s ease;
    }
  }
}

// Sidebar Menu

.v-sidebar-menu {
  width: auto !important;
  padding: 0 $layout-spacer-x $layout-spacer-x;

  %side-link-hover {
    background: $dropdown-link-hover-bg;
    color: $primary;
  }

  & .vsm-item:hover .vsm-icon {
    opacity: .6;
    transform: scale(1.1);
  }
  
  & .vsm-item .vsm-link.active-item .vsm-icon {
    opacity: .8;
  }

  & .vsm-link {
    display: block;
    line-height: 2.4rem;
    height: 2.4rem;
    padding: 0 1.5rem 0 45px;
    position: relative;
    border-radius: .25rem;
    color: $gray-700;
    white-space: nowrap;
    transition: background .25s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                color .25s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                padding .3s ease,
                transform .2s ease;
    text-decoration: none;
    border: 0;
    background: transparent;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;


    &:hover {
      @extend %side-link-hover;
      transform: translateX(2px);
    }

    &.active-item {
      font-weight: 600;
      @extend %side-link-hover;
    }

    &[disabled] {
      opacity: 0.4;
      pointer-events: none;
    }

    &.collapsed {
      font-weight: normal;

      .vsm-arrow {
        transform: rotate(270deg); // Match the default right-pointing rotation
        font-weight: bold;
      }
    }
  }

  & .vsm-title {
    white-space: nowrap;
    position: relative;
  }

  & .vsm-icon {
    text-align: center;
    width: 34px;
    height: 34px;
    line-height: 34px;
    position: absolute;
    left: 5px;
    top: 50%;
    margin-top: -17px;
    font-size: 1.5rem;
    opacity: .3;
    transition: opacity .3s cubic-bezier(0.25, 0.46, 0.45, 0.94), 
                transform .3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                color .3s ease;
  }

  & .vsm-arrow {
    text-align: center;
    width: 34px;
    height: 34px;
    line-height: 34px;
    position: absolute;
    right: 5px;
    top: 50%;
    margin-top: -17px;
    font-size: 1.5rem;
    font-style: normal;
    opacity: .3;
    transition: all 300ms;
    transform: rotate(270deg); // ROTATE 270 DEGREES TO POINT RIGHT

    &:after {
      content: '\e688'; // Original chevron icon
      font-family: 'Pe-icon-7-stroke';
    }
  }

  // When menu is open, rotate arrow down
  &.vsm-open .vsm-arrow {
    transform: rotate(360deg); // ADD 90 MORE DEGREES TO POINT DOWN (270 + 90 = 360)
  }

  & .vsm-dropdown {
    position: relative;

    &::before {
      content: '';
      height: 100%;
      opacity: 1;
      width: 3px;
      background: $dropdown-link-hover-bg;
      position: absolute;
      left: 20px;
      top: 0;
      border-radius: 15px;
    }

    .vsm-list {
      padding: ($layout-spacer-x / 2) 0 ($layout-spacer-x / 2) $layout-spacer-x * 1.5;
    }

    .vsm-item {
      .vsm-link {
        padding: 0 ($layout-spacer-x / 1.5);
        height: 1.9rem;
        line-height: 1.9rem;
        font-weight: normal;
        font-size: 13px;

        &.active-item {
          font-weight: 600;
        }
      }
    }
  }

  & .vsm-header {
    text-transform: uppercase;
    font-size: 11px;
    margin: ($layout-spacer-x * 1.2) 0 ($layout-spacer-x / 2) 0;
    font-weight: bold;
    color: $gray-500;
    white-space: nowrap;
    position: relative;
    letter-spacing: 0.5px;
    padding-left: 5px;
    
    &:first-child {
      margin-top: ($layout-spacer-x / 2);
    }
  }

  & .collapse-btn {
    display: none;
  }

  .collapse {
    // transition: all .26s ease;
    transform: scaleY(0);
    transform-origin: top;
    height: auto;
    max-height: 0;
    display: block !important;
  }

  .collapse.show {
    transform: scaleY(1);
    max-height: 600px;
  }

  .vsm-list > .vsm-item {
    .vsm-link {
      font-weight: normal;

      &.active-item {
        font-weight: bold;
      }
    }
  }
}

.sidebar-menu-overlay {
  position: fixed;
  height: 0%;
  width: 0%;
  z-index: 12;
  background: rgba(0, 0, 0, 0.3);
  display: block;
  content: '';
  left: 0;
  top: 0;
  visibility: hidden;
  opacity: 0;
  transition: opacity .3s ease;
}

.closed-sidebar-md.closed-sidebar-open {
  .sidebar-menu-overlay {
    visibility: visible;
    opacity: 1;
    height: 100%;
    width: 100%;
  }
}

// Modifiers

@import "modifiers/closed-sidebar";


// Sidebar Themes

@import "themes/sidebar-light";
@import "themes/sidebar-dark";
