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

$host-width:180px;
$host-height:300px;
$legends-header-height:36px;

.sipsd-map-legends-host {
  position: absolute;
  bottom: 30px;
  right: 20px;
  width: $host-width;
  max-height: $host-height;
  transition: height .55s;

  &.sipsd-map-legends-host-show {
    height: $host-height;
  }

  &.sipsd-map-legends-host-hide {
    height: 0;
  }
}

.sipsd-map-legends {
  width: 100%;
  height: 100%;
  font-family: "Microsoft YaHei";
}

.sipsd-map-legends-show {
  .legends-header {
    height: $legends-header-height;
    padding: 2px 20px;
    border-width: 1px;
    opacity: 1;
  }
}

.sipsd-map-legends-hide {
  .legends-header {
    height: 0;
    border-width: 0;
    padding: 0;
    opacity: 0;
  }
}

.legends-content {
  position: absolute;
  right: 0;
  bottom: $legends-header-height;
  width: 100%;
  height:calc(100% - #{$legends-header-height});
  border: 1px solid #ccc;
  background-color: #fff;
  transition: height .55s, border .55s;
}

.legends-content-show {
  height:calc(100% - #{$legends-header-height});
}

.legends-content-hide {
  height: 0;
  border-width: 0;
}

@keyframes sipsd-map-legends-content-layerItem-animation {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
}

.content-layerItem {
  width: 100%;
  padding: 10px 10px 0 10px;
  font-size: 14px;
  animation: sipsd-map-legends-content-layerItem-animation .55s;
}

.layerItem-title {
  width: 100%;
  height: 22px;
  overflow: hidden;
  padding-left: 8px;
  line-height: 22px;
  background-color: #333;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}

.layerItem-title-content {
  float: left;
  width: calc(100% - 22px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layerItem-icon {
  display: block;
  float: right;
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  font-size: 14px;
}

.layerItem-legend {
  width: 100%;
  height: 24px;
  overflow: hidden;
  padding: 3px 8px;
  transition: height .55s, padding .55s, opacity .55s;
}

.layerItem-legend-show {
  height: 24px;
  opacity: 1;
}

.layerItem-legend-hide {
  height: 0;
  padding: 0;
  opacity: 0;
}

.legend-icon {
  float: left;
  /* Safari */
  display: -webkit-flex;
  display: flex;
  width: 36px;
  height: 100%;
  justify-content: center;
  align-items: center;

  img {
    max-width: 100%;
    max-height: 100%;
  }
}

.legend-layerName {
  float: left;
  width: calc(100% - 36px - 5px);
  height: 100%;
  margin-left: 5px;
  overflow: hidden;
  line-height: 18px;
  text-overflow: ellipsis;
  font-size: 13px;
  white-space: nowrap;
}

.legends-header {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 36px;
  padding: 2px 20px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  line-height: 36px;
  border: 1px solid #ccc;
  background-color: #fff;
  color: #333;
  font-size: 14px;
  cursor: pointer;
  transition: height .55s, opacity .55s, padding .55s;

  &>i {
    float: left;
    font-size: 22px;
  }

  &>p {
    float: left;
    display: inline-block;
    margin: 0;
    user-select: none;
  }
}
