@import "./common/var.css";

@component-namespace el-color {
  @component hue-slider {
    position: relative;
    box-sizing: border-box;
    width: 205px;
    height: 10px;
    background-color: #f00;
    padding: 0 2px;

    @descendent bar {
      position: relative;
      background: linear-gradient(
        to right, #f00 0%,
        #ff0 17%, #0f0 33%,
        #0ff 50%, #00f 67%,
        #f0f 83%, #f00 100%);
      height: 100%;
    }

    @descendent thumb {
      position: absolute;
      cursor: pointer;
      box-sizing: border-box;
      left: 0;
      top: 0;
      width: 10px;
      height: 10px;
      border-radius: 10px;
      border: 1px solid #000;
      background: #fff;
      box-shadow: 0 0 2px rgba(0, 0, 0, 0.6);
      z-index: 1;
    }

    @when vertical {
      width: 10px;
      height: 205px;
      padding: 2px 0;
      border-radius:6px;

      .el-color-hue-slider__bar {
        background: linear-gradient(
          to bottom, #f00 0%,
          #ff0 17%, #0f0 33%,
          #0ff 50%, #00f 67%,
          #f0f 83%, #f00 100%);
      }

      .el-color-hue-slider__thumb {
        left: 0;
        top: 0;
        width: 10px;
        height: 10px;
        border-radius: 10px;
        border: 1px solid #000;
      }
    }
  }

  @component svpanel {
    position: relative;
    width: 205px;
    height: 205px;
    border-radius: 6px;
    margin-right: 7px;

    @descendent white, black {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      border-radius: 6px;
    }

    @descendent white {
      background: linear-gradient(to right, #fff, rgba(255,255,255,0));
    }

    @descendent black {
      background: linear-gradient(to top, #000, rgba(0,0,0,0));
    }

    @descendent cursor {
      position: absolute;

      > div {
        cursor: head;
        width: 4px;
        height: 4px;
        box-shadow: 0 0 0 1.5px #fff, inset 0 0 1px 1px rgba(0,0,0,0.3), 0 0 1px 2px rgba(0,0,0,0.4);
        border-radius: 50%;
        transform: translate(-2px, -2px);
      }
    }
  }

  @component alpha-slider {
    position: relative;
    box-sizing: border-box;
    width: 280px;
    height: 12px;
    background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==);

    @descendent bar {
      position: relative;
      background: linear-gradient(
        to right, rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 1) 100%);
      height: 100%;
    }

    @descendent thumb {
      position: absolute;
      cursor: pointer;
      box-sizing: border-box;
      left: 0;
      top: 0;
      width: 4px;
      height: 100%;
      border-radius: 1px;
      background: #fff;
      border: 1px solid #f0f0f0;
      box-shadow: 0 0 2px rgba(0, 0, 0, 0.6);
      z-index: 1;
    }

    @when vertical {
      width: 20px;
      height: 180px;

      .el-color-alpha-slider__bar {
        background: linear-gradient(
          to bottom, rgba(255, 255, 255, 0) 0%,
          rgba(255, 255, 255, 1) 100%);
      }

      .el-color-alpha-slider__thumb {
        left: 0;
        top: 0;
        width: 100%;
        height: 4px;
      }
    }
  }

  @component dropdown {
    width: 245px;
    box-sizing: border-box;

    @descendent main-wrapper {
      margin-bottom: 10px;
      display: flex;

      &::after {
        content: "";
        display: table;
        clear: both;
      }
    }
    @descendent header {
      height: 40px;
      width: 100%;
    }
    @descendent headertitle {
      height: 100%;
      font-family:ciscosansttregular,'Helvetica Neue',Helvetica,'PingFang SC','Hiragino Sans GB',SimSun,sans-serif;
      font-size: 14px;
      text-align: left;
      font-weight: 500;
      margin: 0;
    }
    @descendent headerbtn {
      position: absolute;
      right: 10px;
      top: 10px;
      background: transparent;
      border: none;
      padding: 0;
      cursor: pointer;
      font-size:16px;

      .el-dialog__close {
        color: var(--dialog-close-color);
      }

      &:focus, &:hover {
        .el-dialog__close {
          color: var(--dialog-close-hover-color);
        }
      }
    }

    @descendent btns {
      margin-top: 6px;
      text-align: right;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    @descendent input {
      width:128px;
      height: 28px;
      display: flex;
    }
    @descendent color {
      width:24px;
      height: 24px;
      border-radius: 24px;
      background-color: #00CF64;
      border:1px solid #999;
    }

    @descendent value {
      float: left;
      line-height: 26px;
      font-size: 12px;
      color: var(--color-base-black);
    }

    @descendent btn {
      border: 1px solid #dcdcdc;
      color: #333;
      line-height: 24px;
      border-radius: 2px;
      padding: 0 20px;
      cursor: pointer;
      background-color: transparent;
      outline: none;
      font-size: 12px;

      &[disabled] {
        color: #cccccc;
        cursor: not-allowed;
      }
      &:hover {
        color: var(--color-primary);
        border-color: var(--color-primary);
      }
    }

    @descendent link-btn {
      cursor: pointer;
      color: var(--color-primary);
      text-decoration: none;
      padding: 15px;
      font-size: 12px;
      &:hover {
        color: tint(var(--color-primary), var(--button-hover-tint-percent));
      }
    }
  }

  @component picker {
    display: inline-block;
    position: relative;
    line-height: normal;
    width: 18px;
    height: 18px;

    @descendent trigger {
      display: inline-block;
      box-sizing: border-box;
      /*height: 36px;*/
      /*padding: 6px;*/
      /*border: 1px solid #bfcbd9;*/
      /*border-radius: 4px;*/
      font-size: 0;
    }

    @descendent color {
      position: relative;
      display: inline-block;
      box-sizing: border-box;
      border: 1px solid #666;
      width: 18px;
      height: 18px;
      text-align: center;
      border-radius: 18px;

      @when alpha {
        background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==);
      }
    }

    @descendent color-inner {
      position: absolute;
      left: 0;
      top: 0;
      right: 0;
      bottom: 0;
      border-radius: 22px;
    }

    @descendent empty {
      font-size: 12px;
      vertical-align: middle;
      color: #666;
      position: absolute;
      top: 4px;
      left: 4px;
    }

    @descendent icon {
      display: inline-block;
      position: relative;
      top: -6px;
      margin-left: 8px;
      width: 12px;
      color: #888;
      font-size: 12px;
    }

    @descendent panel {
      position: absolute;
      z-index: 10;
      padding: 10px;
      background-color: var(--color-white);
      border: 1px solid var(--color-base-gray);
      box-shadow: var(--dropdown-menu-box-shadow);
    }
  }
}
