@use 'sass:math';
@use 'sass:color';
@use '../global/common' as global;

// ------------------------------
// サイドナビゲーション
// ------------------------------
// ナビゲーション固定
#sidebar {
  height: 100%;
  background: global.$base-bg-light-white;

  .ps__rail-y {
    right: 0;
    left: auto !important;

    .ps__thumb-y {
      width: 8px;
      background: color.adjust(global.$base-bg-primary, $lightness: 45%);
    }
  }

  &.js-mobile {
    height: auto;
  }
}

@media screen and (min-width: global.$breakpoint-md-min) {
  #sidebar {
    background: global.$base-bg-light-gray;
  }
}

.js-nav #acms-admin-main {
  position: absolute;
  top: 0;
  width: 100%;
}

.acms-icon-admin-blog-children {
  color: global.$acms-color-gray80;
}

.acms-sidebar {
  top: 0;
  bottom: 0;
  width: 100%;
  padding-bottom: 0;
}

.acms-sidebar-header .js-acms-dropdown-menu {
  padding: 0;
}

.acms-sidebar-main {
  position: relative;
  box-sizing: border-box;
  height: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.acms-sidebar-alert {
  position: relative;
  padding: 10px 10px 10px 15px;
  margin: 0;
  font-weight: bold;
  color: global.$acms-color-white;
  background: global.$acms-alert-danger-border;

  @include global.font-size(11);

  .acms-icon-tooltip {
    margin-left: 5px;
  }
}

@media screen and (min-width: global.$breakpoint-md-min) {
  .acms-sidebar {
    position: fixed;
    width: auto;
  }

  .acms-sidebar-header {
    width: 175px;
  }

  .acms-sidebar-main {
    width: 175px;
  }
}

.acms-sidebar-title {
  padding-left: calc(5px + constant(safe-area-inset-left));
  background: global.$base-bg-light-gray;
}

// SP用
.acms-sidebar-sp-list {
  display: table;
  width: 100%;
  table-layout: fixed;
  border-bottom: 1px solid #9e9e9e;

  li {
    border-bottom: 0; // acms.cssの打ち消し
  }
}

.acms-sidebar-sp-list-item {
  display: table-cell;
  width: math.div(100%, 3);
  font-weight: bold;
  color: global.$acms-color-black;
  text-align: center;
  vertical-align: middle;
  border-right: 1px solid global.$acms-color-gray60;

  @include global.font-size(20);

  &:last-child {
    border: 0;
  }

  a,
  button {
    display: block;
    width: 100%;
    height: 100%;
    padding: 10px 2px;
    color: inherit;
    appearance: none;
    cursor: pointer;
    background-color: transparent;
    border: 0;
  }

  a:hover,
  button:hover {
    text-decoration: none;
  }

  .acms-icon {
    padding: 0;
  }

  .acms-user-profile {
    display: block;
    margin: 0 auto;
    border: 0;
  }
}

.acms-sidebar-sp-list-text {
  display: block;
  margin-top: 5px;

  @include global.font-size(11);
}

.acms-sidebar-link a {
  padding: 20px 10px 20px 40px;
  padding-left: calc(10px + constant(safe-area-inset-left));
  font-weight: bold;
  color: global.$acms-color-black;
  text-indent: -12px;
  word-break: break-all;
  background: global.$base-bg-light-white;

  @include global.font-size(14);

  &:hover {
    text-decoration: none;
  }
}

.acms-sidebar-item {
  padding: 10px;
  font-weight: bold;
  line-height: 1.2;
  border-bottom: 1px solid global.$acms-color-gray60;

  @include global.font-size(14);

  [class*='acms-label'] {
    font-weight: normal;
  }
}

.acms-sidebar-item-inner {
  display: table;
  width: 100%;
}

.acms-sidebar-item-cell {
  display: table-cell;
}

.acms-sidebar-item-cell-full {
  width: 100%;
}

.acms-sidebar-item-cell-middle {
  vertical-align: middle;
}

@media (min-width: global.$breakpoint-md-min) {
  .acms-sidebar-link a {
    padding: 10px 15px 10px 40px;
    padding-left: calc(10px + constant(safe-area-inset-left));
    text-indent: -12px;
    background: global.$base-bg-light-gray;
  }

  .acms-sidebar-link .stay a {
    background: global.$base-bg-light-white;
  }
}
