@use '../variables.scss' as *;

.progressContainer {
  // Include the global name for now so other things can style it.
  composes: objective-progress from global;
  flex: 1;
  background-color: var(--objective-background-color, #333);
  position: relative;
  min-height: 17px;
  display: flex;
  flex-direction: row;
  align-items: center;

  // If this is a date-time objective, don't show the background
  &:has(time) {
    background-color: transparent;
  }
}

.description {
  position: relative; // so it z-stacks over the progress bar
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 0 4px;
  flex: 1;
  text-shadow: 1px 1px 3px rgb(0, 0, 0, 0.25);
}

.text {
  position: relative; // so it z-stacks over the progress bar
  margin-right: 4px;
  text-shadow: 1px 1px 3px rgb(0, 0, 0, 0.25);
}

.objective {
  display: flex;
  flex-direction: row;
  margin-bottom: 4px;

  // TODO: use flex containers instead - ObjectiveGroup?
  &:last-child {
    margin-bottom: 0;
  }

  &.objectiveComplete {
    --objective-background-color: #222;
    opacity: 0.5;
  }

  &.boolean {
    --objective-background-color: transparent;
    .description {
      padding: 0;
    }
  }
}

.counter {
  height: 17px;
  margin-left: 4px;
  margin-right: 2px;
  text-align: center;
  box-sizing: border-box;
}

.integer {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  color: var(--theme-text);
  img {
    width: 16px;
    height: 16px;
    margin-right: 8px;
  }
}

.passageFlawed::after {
  content: '\274c';
  position: relative;
  top: -1px;
  left: -0.2px;
}

.checkbox {
  width: 17px;
  height: 17px;
  border: 1px solid #999;
  margin-right: 4px;
  box-sizing: border-box;
  background-color: rgb(0, 0, 0, 0.3);

  &.complete::after {
    content: '';
    display: block;
    margin: 2px;
    height: calc(100% - 4px);
    width: calc(100% - 4px);
    background-color: var(--objective-checkbox-color, $xp);
  }
}

.progressBar {
  background-color: var(--objective-progress-color, $xp);
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
}
