@import './../../../scss/v-sipsd-map-layers';

@keyframes sipsd-map-layers-animation {
  from {
    right: 0;
    opacity: 0;
  }
}

.sipsd-map-layers-host {
  position: absolute;
  top: 20px;
  right: 20px;
  width: $sipsd-map-layers-width;
  max-height: $sipsd-map-layers-height;
  animation: sipsd-map-layers-animation .55s;
}

.sipsd-map-layers {
  width: 100%;
  height: 100%;
  color: #3d3d3d;
}

.layers-header {
  display: flex;
  width: 100%;
  height: $sipsd-map-layers-header-height;
  text-align: center;
}

.header-func-1 {
  width: 100%;
  height: 30px;
}

.header-func-2 {
  display: inline-block;
  width: 50%;
  height: 30px;

  &:first-child {
    padding-right: 1.5px;
  }

  &:last-child {
    padding-left: 1.5px;
  }
}

.header-func-3 {
  display: inline-block;
  width: calc(100%/3);
  height: 30px;

  &:first-child {
    padding-right: 2px;
  }

  &:nth-of-type(2) {
    padding: 0 1px;
  }

  &:last-child {
    padding-left: 2px;
  }
}

.header-baseLayers,
.header-imageLayers,
.header-layersTree {
  width: 100%;
  height: 30px;
  display: inline-block;
  overflow: hidden;
  line-height: 30px;
  box-shadow: 0 0 4px rgba(0, 0, 0, .2);
  background-color: #fff;
  cursor: pointer;

  &:hover {
    background-color: #0593d3;
    color: #fff;

    .icon-baseLayers,
    .icon-imageLayers,
    .icon-layersTree {
      background-position-y: -16px;
    }
  }
}

.header-activated {

  .header-baseLayers,
  .header-imageLayers,
  .header-layersTree {
    background-color: #0593d3;
    color: #fff;
  }

  .icon-baseLayers,
  .icon-imageLayers,
  .icon-layersTree {
    background-position-y: -16px;
  }
}

.header-icon {
  float: left;
  height: 16px;
  margin: 7px 0;
  line-height: 16px;
  background-image: url($header-icon-background-image-url);
  background-repeat: no-repeat;
}

.icon-baseLayers,
.icon-imageLayers,
.icon-layersTree {
  width: 16px;
  margin-left: 4px;
}

.icon-imageLayers {
  background-position-x: -16px;
}

.icon-layersTree {
  background-position-x: -32px;
}

.header-title {
  width: calc(100% - 20px - 22px);
  height: 30px;
  line-height: 30px;
  float: left;
  font-size: 12px;
  text-align: center;
}

.icon-arrow {
  width: 21px;
  border-left: 1px solid #ebebeb;
  background-image: none;
}

.layer-content {
  width: 100%;
  height: $sipsd-map-layers-content-height;
  margin-top: 5px;
  overflow: hidden;
  transition: height .55s;
  box-shadow: 0 0 4px rgba(0, 0, 0, .2);
  background-color: #fff;
}

.layer-content-show {
  height: $sipsd-map-layers-content-height;
}

.layer-content-hide {
  height: 0;
}

.content-function {
  width: 100%;
  height: 30px;
  padding: 0 10px;
  overflow: hidden;
  border-bottom: 1px solid #d2d2d2;
}

.icon-clearLayer {
  width: 30px;
  height: 30px;
  float: left;
  background-image: url($icon-clearLayer-background-image-url);
  background-repeat: no-repeat;
  cursor: pointer;

  &:hover {
    background-position-y: -30px;
  }
}

.icon-search {
  width: calc(100% - 30px - 30px);
  height: 30px;
  float: left;
  line-height: 30px;
}

.search-condition-form {
  position: relative;
  width: 100%;
  height: 30px;
  display: -webkit-flex;
  display: flex;
  justify-content: center;
  align-items: center;
}

.condition-key {
  width: calc(100% - 5px);
  height: 26px;
  line-height: 26px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  padding-left: 5px;
  padding-right: 25px;
  font-size: 14px;

  &:hover {
    border-color: #49a9ee;
  }

  &:focus {
    border-color: #49a9ee;
    outline: 0;
    box-shadow: 0 0 0 2px rgba(16, 142, 233, 0.2);
  }
}

.search-icon {
  position: absolute;
  right: 8px;
  display: inline-block;
  cursor: pointer;

  i {
    font-size: 16px;
  }
}

.icon-pushpin {
  width: 30px;
  height: 30px;
  float: left;
  text-align: center;
  line-height: 30px;
  cursor: pointer;
}

.content-list {
  width: 100%;
  height: calc(100% - 30px);
}

.list-baseLayers,
.list-imageLayers,
.list-layersTree {
  width: 100%;
  box-sizing: border-box;
  padding: 0 10px 10px;
  overflow: hidden;
  transition: padding .55s, opacity .5s;
}

.list-baseLayers-show {
  padding: 0 10px 10px;
  opacity: 1;

  .baseLayer-item {
    height: $sipsd-map-layers-baseLayer-item-height;
    padding: 10px 5px 0;
  }
}

.list-baseLayers-hide {
  padding: 0;
  opacity: 0;

  .baseLayer-item {
    height: 0;
    padding: 0;
  }
}

.list-imageLayers-show {
  padding: 0 10px 10px;
  opacity: 1;

  .imageLayers-item {
    height: 78px;

    &:first-child {
      margin-top: 10px;
    }
  }

  .imageLayers-item-icon-line,
  .imageLayers-item-name,
  .imageLayers-item-icon {
    height: $sipsd-map-layers-imageLayers-item-height;
  }

  .imageLayers-item-icon-line-bottom {
    height: 12px;
  }
}

.list-imageLayers-hide {
  padding: 0;
  opacity: 0;

  .imageLayers-item {
    height: 0;

    &:first-child {
      margin-top: 0;
    }
  }

  .imageLayers-item-icon-line,
  .imageLayers-item-name,
  .imageLayers-item-icon,
  .imageLayers-item-icon-line-bottom {
    height: 0;
  }

  .imageLayers-item-icon {
    padding: 0;
  }
}

@keyframes sipsd-map-layers-list-layersTree-show-animation {
  from {
    height: 0;
    padding: 0;
    opacity: 0;
  }
}

@keyframes sipsd-map-layers-list-layersTree-hide-animation {
  from {
    // 因为内容的高度不固定，所以从高度值很大的地方开始收起动画，
    // 避免收起内容过渡动画还没完时，内容直接没掉
    height: 100000%;
    padding: 0 10px 10px;
    opacity: 1;
  }

  to {
    height: 0;
    padding: 0;
    opacity: 0;
  }
}

.list-layersTree-show {
  width: auto;
  height: auto;
  overflow: visible;
  padding: 0 10px 10px;
  animation: sipsd-map-layers-list-layersTree-show-animation .55s;
}

.list-layersTree-hide {
  height: 0;
  padding: 0;
  animation: sipsd-map-layers-list-layersTree-hide-animation .55s;
}

.baseLayer-item {
  width: 50%;
  height: $sipsd-map-layers-baseLayer-item-height;
  box-sizing: border-box;
  float: left;
  padding: 10px 5px 0;
  cursor: pointer;
  transition: height .55s, padding .55s;
}

.baseLayer-item-icon {
  width: 100%;
  height: calc(100% - 16px);
  box-sizing: border-box;
  padding: 4px;

  .image-item {
    width: 100%;
    height: 100%;
    background-image: url($baseLayer-item-icon-image-item-background-image-url);
  }
}

.baseLayer-item-name {
  width: 100%;
  height: 16px;
  font-size: 12px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.baseLayer-activated,
.imageLayers-activated {
  color: #0593d3;

  .baseLayer-item-icon,
  .imageLayers-item-icon {
    background-color: #0593d3;
  }
}

.imageLayers-item {
  width: 100%;
  height: 78px;
  box-sizing: border-box;
  overflow: hidden;
  cursor: pointer;
  transition: height .55s, margin-top .55s, ;

  &:first-child {
    margin-top: 10px;
  }
}

.imageLayers-item-icon-line,
.imageLayers-item-name,
.imageLayers-item-icon {
  height: $sipsd-map-layers-imageLayers-item-height;
  transition: height .55s;
}

.imageLayers-item-icon-line {
  float: left;
  width: 12px;
  height: $sipsd-map-layers-imageLayers-item-height;
  background-image: url($mageLayers-item-icon-line-background-image-url);
  background-repeat: no-repeat;
}

.imageLayers-item-icon-line-select {
  float: left;
  width: 12px;
  height: $sipsd-map-layers-imageLayers-item-height;
  background-image: url($imageLayers-item-icon-line-select-background-image-url);
  background-repeat: no-repeat;
}

.imageLayers-item-icon-line-bottom {
  width: 100%;
  height: 12px;
  float: left;
  background-image: url($imageLayers-item-icon-line-bottom-background-image-url);
  background-repeat: no-repeat;
  transition: height .55s;
  ;
}

.imageLayers-item-name {
  float: left;
  width: 48px;
  box-sizing: border-box;
  padding: 0 3px;
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  text-align: center;
}

.imageLayers-item-icon {
  float: left;
  width: calc(100% - 12px - 48px);
  box-sizing: border-box;
  padding: 3px;

  .image-item {
    width: 100%;
    height: 100%;
    background-image: url($imageLayers-item-icon-image-item-background-image-url);
  }
}

.list-layersTree {
  /deep/ {
    sipsd-ztree {
      span.button {

        &.ico_open,
        &.ico_close,
        &.ico_docu {
          background-position: 2.5px !important;
        }
      }
    }
  }
}
