@use '../../../../styles/_globals.scss' as *;
@use '../../tasks/task/task.component.mixins' as *;

:host {
  border-radius: var(--task-border-radius);
  min-height: var(--planner-item-height);
  display: flex;
  align-items: stretch;
  @include grabCursor();
  color: var(--text-color);
  background: var(--task-c-bg);
  box-shadow: var(--task-shadow);
  border: var(--task-border, none);

  &.isDone {
    opacity: var(--task-is-done-dim-opacity);

    .title {
      text-decoration: line-through;
    }
  }

  // note: we use .tags-container, since we don't want margins for an empty list
  ::ng-deep .tags-container {
    // to match task title padding
    margin-left: 3px;
    margin-bottom: var(--s-quarter);
    margin-top: var(--s-quarter);
  }
}

:host.isDragReady:not(.cdk-drag-placeholder) {
  background: var(--bg-lighter);
  box-shadow: var(--whiteframe-shadow-8dp);
  z-index: 1;
  position: relative;
  transition:
    background 150ms ease-out,
    box-shadow 150ms ease-out;
}

:host.isCurrent {
  background: var(--task-c-current-bg);
  box-shadow: var(--task-current-shadow);
}

.no-drag {
  display: flex;
  align-items: center;
  flex-grow: 1;
  flex-shrink: 1;
  min-width: 0;
  position: relative;
  padding: var(--s-half) 0;

  @include mq(xs) {
    padding: var(--s-quarter) 0;
  }
}

:host ::ng-deep .tag-title {
  @include mq(xs) {
    font-size: var(--planner-font-size-smaller) !important;
  }
}

swipe-block {
  flex-grow: 1;
  min-width: 0;
}

.task-content {
  display: flex;
  align-items: stretch;
  flex-grow: 1;
  min-width: 0;
}

done-toggle {
  --done-toggle-size: 30px;

  margin-left: var(--s-half);
  align-self: center;
  cursor: pointer;
}

.wrap {
  flex-grow: 1;
  flex-shrink: 1;
  min-width: 0;
}

.title {
  padding-left: var(--s-half);
  padding-right: var(--s-half);
  // to have room for the coloured edit border
  padding-top: 1px;
  padding-bottom: 1px;

  line-height: 1.5;
  position: relative;
  overflow: hidden;
  overflow-wrap: anywhere;
  flex-grow: 1;
  flex-shrink: 1;

  @include mq(xs) {
    font-size: var(--planner-font-size);
  }
}

.parent-title {
  padding-left: var(--s-half);
  padding-right: var(--s-half);
  padding-top: var(--s-half);
  padding-bottom: var(--s-half);
  overflow: hidden;
  overflow-wrap: anywhere;
  line-height: 1.1;
  font-size: var(--planner-font-size-smaller-mobile);

  @include mq(xs) {
    font-size: var(--planner-font-size-smaller);
  }
}

.planner-time-remaining-shared {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  flex-shrink: 0;
  margin-left: auto;
  padding: 0;
  padding-right: var(--s);
  border: 1px solid transparent;

  &.hasNoTimeSpentOrEstimate {
    text-align: center;
  }

  inline-input {
    min-width: 44px;
    text-align: right;
  }

  inline-input ::ng-deep input {
    line-height: 1.5;
  }

  .sub-task-count {
    font-style: italic;
    white-space: nowrap;
    line-height: 1;
    margin-top: var(--s-quarter);

    mat-icon {
      font-size: 14px;
      width: 14px;
      height: 14px;
      vertical-align: middle;
      margin-right: 1px;
    }
  }
}

.original-time-remaining {
  white-space: nowrap;
  font-size: 10px;
  margin-left: -6px;
}

:host ::ng-deep .due-date + .planner-time-remaining-shared {
  display: none;
}
