@import '../../style/theme/color';
@import '../../style/theme/shadow';
@import '../../style/theme/corner';

:host {
  display: block;
}

.devui-gantt-bar {
  position: relative;
  width: 100%;
  cursor: pointer;
  box-sizing: border-box;
  height: 24px;
  z-index: 3;

  .devui-gantt-main {
    cursor: move;

    &.disabled {
      cursor: not-allowed;
    }
  }

  .devui-gantt-bar-rail-normal {
    background: $devui-blue-20;
  }

  .devui-gantt-bar-rail-overdue {
    background: $devui-red-10;
  }

  .devui-gantt-bar-rail-done {
    background: $devui-gray-10;
  }

  .devui-gantt-bar-rail {
    position: absolute;
    box-shadow: $devui-shadow-length-base rgba(81, 112, 255, 0.19); // TODO: color not variable
    height: 20px;
    margin-top: 4px;
    width: 100%;
    border-radius: $devui-border-radius;

    &.disabled {
      background-color: $devui-area;
    }
  }

  & .devui-gantt-hover-layer {
    display: none;
    position: absolute;
    height: 24px;
    top: 2px;
    left: -12px;
    border-radius: $devui-border-radius;
    background-color: $devui-connected-overlay-bg;
    box-shadow: $devui-shadow-length-hover rgba(81, 112, 255, 0.3); // TODO: color not variable

    & .devui-gantt-dragger {
      position: absolute;
      width: 12px;
      height: 24px;
      cursor: col-resize;
      display: flex;
      align-items: center;

      &.left {
        left: 0;
      }

      &.right {
        right: 0;
      }

      & .handle {
        width: 2px;
        height: 14px;
        background: $devui-icon-fill;
        border-radius: $devui-border-radius;
        margin: 4px 4px;

        &.disabled {
          cursor: not-allowed;
        }
      }
    }
  }

  .devui-gantt-bar-track-overdue {
    background-color: $devui-danger;
  }

  .devui-gantt-bar-track-done {
    background-color: $devui-gray-40;
  }

  .devui-gantt-bar-track-normal {
    background-color: $devui-brand;
    box-shadow: $devui-shadow-length-base rgba(81, 112, 255, 0.4);
  }

  .devui-gantt-bar-track {
    position: absolute;
    border-radius: $devui-border-radius 0 0 $devui-border-radius;
    border-radius: $devui-border-radius 0 0 $devui-border-radius;
    height: 20px;
    margin-top: 4px;
    width: 0;
  }

  .devui-gantt-bar-progress {
    display: none;
    position: absolute;
    left: 0;
    bottom: -8px;
    transform: translateX(-50%);
    cursor: pointer;

    & > svg {
      display: block;

      & > g > path {
        fill: $devui-icon-bg;
        stroke: $devui-icon-fill-active;
      }
    }

    &.visible {
      display: block;
    }

    &.disabled {
      cursor: not-allowed;
    }
  }

  &:hover .devui-gantt-bar-progress {
    display: block;
  }

  .devui-gantt-bar-title {
    position: absolute;
    display: inline-flex;
    align-items: center;
    left: 100%;
    height: 100%;
    margin-left: 12px;
    word-break: keep-all;
  }
}

.devui-gantt-tips {
  width: 280px;
  min-height: 100px;
  background: $devui-base-bg;
  box-shadow: $devui-shadow-length-feedback-overlay rgba(81, 112, 255, 0.1);
  border-radius: $devui-border-radius-card;
  padding: 16px;
  margin-top: 8px;
}

.moving-bg {
  position: absolute;
  height: 100%;
  top: 0;
  bottom: 0;
  background: $devui-float-block-shadow;
  opacity: 0.3;
}
