// Settings
.modal.mod-sidebar-layout {
  backdrop-filter: none;
  background-color: var(--mobile-sidebar-background, var(--background-secondary));

  .vertical-tab-header {
    border-inline-end: none;
    background-color: unset;
    position: relative;
  }
  .horizontal-tab-nav-item,
  .vertical-tab-nav-item,
  .vertical-tab-header-group-title {
    padding: calc(8px * var(--density-modifier)) 16px;
  }
  .horizontal-tab-content,
  .vertical-tab-content {
    background-color: transparent;
    scrollbar-gutter: stable;
  }

  .setting-item {
    padding: calc(16px * var(--density-modifier)) 0;
  }
  .setting-item-name {
    font-weight: var(--font-medium);
    overflow: visible;
  }
  .setting-item-description {
    color: var(--text-faint);
    word-break: break-word;
  }
}

body:not(.nav-item-subtle, .nav-item-strong) .modal.mod-sidebar-layout {
  .vertical-tab-nav-item:not(:hover) {
    transition: var(--anim-duration-moderate), font-weight 0s;
  }
  .vertical-tab-nav-item:hover:not(.is-active) {
    font-weight: var(--nav-item-weight-hover);
    background-color: var(--nav-item-background-hover);
  }
  .vertical-tab-nav-item.is-active {
    font-weight: var(--nav-item-weight-active);
    display: inline-flex;
    align-items: center;
    background-color: var(--nav-item-background-active);
    color: var(--nav-item-color-active);

    &::before {
      content: "";
      position: absolute;
      margin-left: -12px;
      width: 4px;
      height: 4px;
      border-radius: var(--button-radius);
      background-color: var(--nav-item-color-active);
    }
  }
}
body.nav-item-subtle .modal.mod-sidebar-layout {
  .vertical-tab-nav-item.is-active {
    background-color: var(--nav-item-background-active);
    color: var(--nav-item-color-active);
  }
}

body:not(.is-mobile) .modal.mod-sidebar-layout {
  .vertical-tab-content {
    container-type: inline-size;
  }

  @container (max-width: 560px) {
    .vertical-tab-content {
      .setting-item-info {
        margin-inline-end: 0;
        width: 100%;
      }
      .setting-item:not(.setting-item-heading) {
        flex-wrap: wrap;
        gap: 8px;
      }
      .setting-item-control {
        gap: 8px;
      }

      button {
        white-space: normal;
      }

      select,
      .dropdown,
      input:not([type="color"]) {
        flex: 1;
        text-overflow: ellipsis;
      }
    }
  }
}

body.is-mobile .modal.mod-sidebar-layout {
  background-color: var(--mobile-sidebar-background);

  .modal-title:not(:has(.modal-setting-back-button)) {
    font-size: var(--h1-size);
    max-width: 100%;
    padding-left: calc(var(--safe-area-inset-side) + 8px);
  }
  .modal-close-button {
    padding: 12px;
  }
  .modal-close-button::before {
    width: var(--icon-m);
    height: var(--icon-m);
    font-size: var(--icon-s);
  }
}

body.is-phone .modal.mod-sidebar-layout {
  .modal-header {
    border-bottom: none;
    padding-top: calc(var(--safe-area-inset-top) + 10px);
  }
  .modal-setting-back-button {
    inset-inline-start: 8px;
    border-radius: 100vh;
  }
  .modal-setting-back-button-icon {
    margin-inline-end: 0;
  }
  .modal-close-button {
    top: var(--safe-area-inset-top);
  }

  .vertical-tab-header,
  .vertical-tab-content {
    background-color: var(--mobile-sidebar-background);
    box-shadow: none;
  }
}

// Community {
.modal.mod-sidebar-layout.mod-community-modal {
  .modal-sidebar {
    padding: 0;
  }

  .community-modal-controls {
    display: flex;
    flex-wrap: wrap;
    padding: 8px;
    gap: 16px;

    .setting-item {
      padding: 0;
      margin: 0;
    }
    .setting-item:first-child {
      margin-right: auto;

      .setting-item-info {
        display: none;
      }
    }
    .setting-item:nth-last-child(2) {
      margin-right: 40px;
    }
    .community-modal-search-summary {
      display: none;
    }
  }
  .community-item .flair {
    top: 0;
    border-radius: var(--button-radius);
    padding: 4px 8px;
  }
}
body.is-phone .modal.mod-sidebar-layout.mod-community-modal {
  .community-modal-controls {
    padding: 16px;
    background-color: var(--system-status-background);
  }
  .community-modal-controls .setting-item {
    margin-right: unset;
    width: 100%;
  }
  .community-modal-controls .setting-item .setting-item-control {
    margin-top: 0;
  }
}
body.is-tablet .modal.mod-sidebar-layout.mod-community-modal {
  .community-modal-controls {
    padding: 10px;
  }
  .community-modal-controls .setting-item:nth-last-child(2) {
    margin-right: 52px;
  }
}
