@import '../../../styles/vars';

:host {
  position: relative;
  transition: all 350ms $ease 0s;

  .color {
    display: block;
    position: relative;
    transition: $transition-normal;
    height: 50px;
    width: 50px;
    background: rgb(255, 255, 255);
    border-radius: 8px;
    border:  1px solid rgba(0, 0, 0, 0.2);
    box-shadow: inset -1px -1px 0px rgba(0, 0, 0, 0.2), inset 1px 1px 0 0 rgba(255, 255, 255, 0.3), 0 2px 4px rgba(0, 0, 0, 0.2);
    transform: scale(1);
    opacity: 1;

    &:hover {
      transition: $transition-normal;
      cursor: pointer;
      transform: scale(1.14);

      .remove {
        opacity: 1;
      }
    }

    .remove {
      opacity: 0;
      position: absolute;
      width: 20px;
      height: 20px;
      top: -6px;
      right: -6px;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: $transition-normal;
      background: #666666;
      border-radius: 50%;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);

      &:hover {
        transition: $transition-normal;
        background: #888;
      }

      svg {
        width: 8px;
        min-width: 8px;
        height: 8px;
        fill: #fff;
      }
    }
  }

  .color-picker-wrapper {
    opacity: 0;
    position: absolute;
    top: 0;
    right: 56px;
    z-index: 1000;
    transition: $transition-normal;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: $box-shadow-strong;

    // Close button for mobile
    button.close {
      display: none;
    }

    ::ng-deep color-chrome {
      display: block;

      .chrome-picker {
        width: 280px;
        border-radius: 0;

        .saturation {
          border-radius: 0 !important;
        }
      }

      .chrome-color {
        display: none;
      }

      .chrome-toggle {
        display: none;
      }

      .chrome-hue {
        height: 20px !important;
      }

      .color-saturation:hover {
        cursor: pointer;
      }

      .saturation-circle:hover {
        cursor: pointer;
      }

      .saturation-pointer:hover {
        cursor: pointer;
      }

      .color-hue-container {
        &:hover {
          cursor: pointer;
        }
      }

      .color-hue-slider {
        width: 22px !important;
        height: 22px !important;
        border-radius: 50% !important;
        transform: translate(-12px, -2px) !important;

        &:hover {
          cursor: grab;
        }

        &:active {
          cursor: grabbing;
        }
      }

      .chrome-wrap {
        padding-top: 10px !important;
        font-family: Lato, sans-serif !important;

        color-editable-input {
          .wrap {
            width: 100%;

            input {
              height: 40px !important;
              font-size: 16px !important;
              font-weight: 300;
              border-radius: 5px !important;
              color: #000000 !important;
              box-shadow: none !important;
              border: 1px solid #d3d9de !important;

              &:focus {
                outline: none;
              }
            }

            span {
              font-size: 12px !important;
            }
          }
        }
      }
    }
  }

  // Tablet
  @media screen and (max-width: $breakpoint-tablet) {
    .color-picker-wrapper {
      top: 56px;
      left: 0;
      right: unset;
    }
  }

  // Mobile
  @media screen and (max-width: $breakpoint-mobile) {
    position: unset;

    .color {
      .remove {
        display: flex;
        opacity: 1;
      }
    }

    .color-picker-wrapper {
      top: 4px;
      right: 0;
      left: 10px;
      border: 1px solid grey;

      // Close button for mobile
      button.close {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        height: 50px;
        width: 100%;
        background: #F5F5F5;
        border-top-left-radius: 8px;
        border-top-right-radius: 8px;
        transition: $transition-normal;

        svg {
          width: 20px;
          height: 20px;
          fill: #333;
          margin-right: 20px;
        }

        &:hover {
          background: #e5e5e5;
          transition: $transition-normal;
        }
      }

      ::ng-deep {
        color-chrome .chrome-picker {
          width: 100% !important;
        }
      }
    }
  }

  &.is-showing-color-picker {
    .color-picker-wrapper {
      transition: $transition-normal;
      opacity: 1;
    }
  }

  &.is-removing {
    .color {
      transform: scale(0);
      opacity: 0.3;

      .remove {
        display: none;
      }
    }
  }
}
