:host {
  overflow: auto;
  display: flex;
  flex-direction: column;

  // !!! Хак пока не сделан программный горизонтальный скроллбар доски
  height: calc(100vh - 66px);

  // TODO: временный хак для деска
  margin-left: -10px;
  padding-right: 10px;

  // TODO: Хак для темы Jira / Confluence Убрать после рефакторинга верстки контейнеров в project, desk
  &.displaced {
    height: calc(100vh - 116px);
  }

  .header {
    position: sticky;
    z-index: 3;
    top: 0;

    display: flex;
    flex-direction: column;
    gap: 7px;
    justify-content: space-between;

    height: 124px;
    padding-top: 20px;
    padding-bottom: 10px;
    padding-left: 50px;

    background-color: var(--color-gray-fff);

    .toolbar {
      display: flex;
      gap: 20px;
      align-items: center;
      align-self: flex-end;

      width: 100%;
      min-height: 54px;

      border-bottom: 1px solid var(--color-gray-eee);

      .person {
        display: flex;
        gap: 10px;
        align-items: center;

        .name {
          display: flex;
          align-items: center;
          font-size: 20px;

          .hidden {
            visibility: hidden;
          }
        }

        .user-select {
          cursor: pointer;
        }
      }

      .select {
        width: 100px;
      }

      .submit-btn {
        cursor: not-allowed;

        display: flex;
        align-items: center;
        justify-content: center;

        height: 30px;
        margin-right: 20px;
        margin-left: auto;

        color: #fff;

        background-color: var(--accent-color-bg);
        border-radius: 4px;

        .text {
          padding: 4px 10px;
          font-weight: bold;
          border-right: 1px solid transparent;
        }

        .icon {
          padding-right: 10px;
        }
      }
    }

    .week-controls {
      display: flex;
      gap: 5px;
      align-items: center;

      span {
        font-weight: bold;
      }

      .control-btn {
        cursor: pointer;

        display: flex;
        align-items: center;
        justify-content: center;

        padding: 8px;

        border-radius: 4px;

        &.today-btn {
          font-weight: bold;
        }

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

        &:hover:not(.disabled) {
          background-color: var(--color-gray-eee);
        }
      }
    }

    .progress {
      display: flex;
      flex-direction: column;
      gap: 5px;

      min-width: 150px;
      margin-left: auto;
      padding-right: 15px;

      border-right: 1px solid #e0e2ec;

      .bar-wrapper {
        width: 100%;
        height: 6px;
        background: rgb(0 73 118 / 8%);
        border-radius: 3px;

        .bar {
          height: 6px;
          background: #00a661;
          border-radius: 3px;
          transition: all 400ms cubic-bezier(0.4, 0.15, 0, 0.975) 0s;
        }
      }
    }

    .cog-icon,
    .filter-icon {
      cursor: pointer;
      padding: 0 10px;
    }
  }
}

.cal-event.cal-event__custom.dummy {
  opacity: 0.5;
}

.cal-event.cal-event__custom {
  touch-action: none;
  cursor: move;
  user-select: none;

  transform: scaleX(calc(100% - 8px));

  display: flex;
  gap: 3px;

  min-height: 20px;

  color: rgb(0 28 61 / 72%);
  text-decoration: none;

  background: rgb(238 243 248);
  border: 1px solid #c3c6cf;
  border-radius: 4px;

  transition:
    min-height 0.3s ease 0s,
    box-shadow 0.3s ease-in-out 0s;

  .color-line {
    flex: 0 0 3px;
    margin: 4px 0;

    &.alarm {
      background-color: cyan;
    }

    &.plan {
      background-color: #27b0ed;
    }
  }

  &:hover {
    .controls {
      cursor: pointer;
      z-index: 3;
      visibility: visible;
      transition-delay: 0.2s;
    }
  }

  .controls {
    position: absolute;
    top: 5px;
    right: 10px;

    display: flex;

    visibility: hidden;

    &.upper {
      top: -30px;
      transition-delay: 0.2s;
    }

    .control {
      display: flex;
      align-items: center;
      justify-content: center;

      width: 28px;
      height: 28px;

      background: #004788;

      &.spaced {
        margin-left: 5px;
      }

      &:hover {
        background: #002649;
        transition: ease-in-out 0.2s;
      }
    }
  }

  .time {
    font-weight: bold;
  }

  .title {
    overflow: hidden;
    font-weight: bold;
    text-overflow: ellipsis;
  }

  .description {
    overflow: hidden;

    font-size: 12px;
    line-height: 16px;
    color: rgb(0 28 61 / 72%);
    text-overflow: ellipsis;
  }

  .bottom {
    display: flex;
    gap: 3px;
    max-width: 100%;

    .code {
      cursor: pointer;
      overflow: hidden;
      color: var(--color-gray-666);
      text-overflow: ellipsis;
    }

    .time {
      margin-left: auto;
    }
  }

  .small {
    overflow: hidden;
    display: flex;
    flex: 1 1 auto;
    gap: 2px;
    align-items: center;

    .time {
      margin-left: auto;
    }
  }

  .medium {
    display: flex;
    flex-direction: column;
    justify-content: space-between;

    width: 100%;
    height: 100%;
    padding: 4px;
  }

  .full {
    display: flex;
    flex-direction: column;
    justify-content: space-between;

    width: 100%;
    height: 100%;
    padding: 4px;

    &.alarm {
      .top {
        flex-direction: row;
      }

      .bottom {
        justify-content: flex-start;
      }
    }

    .top {
      display: flex;
      flex-direction: column;
      gap: 5px;

      .title {
        overflow: hidden;
        display: -webkit-box;
        -webkit-box-orient: vertical;

        font-size: 14px;
        font-weight: bold;
        hyphens: auto;
        text-align: left;
        text-overflow: ellipsis;
        word-break: inherit;
        overflow-wrap: break-word;
        white-space: normal;

        -webkit-line-clamp: 2;
      }

      .description {
        overflow: hidden;
        display: -webkit-box;
        -webkit-box-orient: vertical;

        font-size: 12px;
        line-height: 16px;
        color: rgb(0 28 61 / 72%);
        text-overflow: ellipsis;
        word-break: break-word;
        overflow-wrap: break-word;
        white-space: pre-wrap;

        -webkit-line-clamp: 5;
      }
    }
  }

  &:hover {
    border: 1px solid #004788;
    box-shadow:
      rgb(0 0 0 / 12%) 0 2px 4px 0,
      rgb(0 0 0 / 8%) 0 4px 12px 0;
  }
}

.cal-hour-segment {
  &__custom {
    .cal-time-day {
      position: absolute;
      display: none;
      align-items: center;
      justify-content: center;
    }

    &:hover {
      .cal-time-day {
        transform: translateY(-50%);
        display: flex;
        gap: 5px;
        width: 100%;

        hr {
          flex: 1;
        }

        span {
          user-select: none;
        }
      }
    }

    &.cal-after-hour-start {
      .cal-time {
        display: none;
      }
    }

    .cal-time {
      transform: translateY(-50%);
      font-family: var(--default-font-family);
      font-weight: normal;
    }
  }
}

.cal-header {
  display: flex;
  flex-direction: column;

  &.cal-future {
    .numbers {
      opacity: 0.7;
    }
  }

  .top {
    position: relative;

    display: flex;
    align-items: center;

    width: 100%;
    height: 48px;
    padding: 0 8px;

    border-bottom: 1px solid #c3c6cf;

    .numbers {
      display: flex;
      gap: 5px;
      width: 100%;

      .day,
      .spent {
        font-weight: bold;
      }

      .date {
        margin-right: auto;
      }
    }

    .progress {
      position: absolute;
      bottom: 0;

      align-self: flex-start;

      height: 3px;

      background-color: #19a56b;

      transition: all 400ms cubic-bezier(0.4, 0.15, 0, 0.975) 0s;
    }
  }

  .bottom {
    display: flex;
    align-items: center;
    justify-content: center;

    height: 48px;
    padding: 8px;

    .plus {
      display: flex;
      align-items: center;
      justify-content: center;

      width: 100%;
      height: 100%;

      font-size: 30px;

      background-color: rgb(0 71 136 / 8%);
      border-radius: 4px;

      span {
        color: var(--default-color);
      }
    }

    .actions {
      overflow: hidden;
      display: none;
      align-items: center;
      justify-content: center;

      width: 100%;
      height: 100%;

      font-weight: bold;

      background-color: rgb(0 71 136 / 8%);
      border-radius: 4px;

      .action {
        cursor: pointer;

        display: flex;
        flex: 1;
        align-items: center;
        justify-content: center;

        height: 100%;

        transition: ease-in-out 0.2s;

        &:hover {
          background-color: rgb(0 71 136 / 18%);
        }
      }
    }

    &:hover {
      .plus {
        display: none;
      }

      .actions {
        display: flex;
      }
    }
  }
}

app-cmf-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.layers-menu-item {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 50px;
}

.users-menu-item {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 50px;
}

.input-wrapper {
  position: absolute;
  padding: 5px 10px;

  .users-menu-input {
    border: none;

    &:focus,
    &:focus-visible {
      border: none;
      outline: none;
    }
  }
}

app-cmf-doodle-icon {
  display: flex;
}
