/* ANIMATIONS */

@keyframes opacity {
  to {
    opacity: 1;
  }
}

@keyframes rotate {
  to {
    rotate: 1turn;
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.8;
  }
  50% {
    opacity: 0.1;
  }
}

/* MODEL LOADING STATUS */

#modelStatusWrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 0.2rem 0.6rem;
  font-family: monospace;
  text-align: center;
  background-color: rgb(from var(--color) r g b / 25%);
  transition: var(--background-color-transition-default);
  &.not-started, &.preparing {
    --color: var(--neutral-color);
  }
  &.ready {
    --color: var(--primary-color);
  }
  &.generating-response {
    --color: var(--ai-color);
  }
  &.error {
    --color: var(--error-color);
  }
}

#modelStatus {
  color: var(--color);
  padding-right: 0.4rem;
  &.not-started::before {
    content: '⚫️ Model not ready';
  }
  &.preparing::before {
    content: '⚫️ Preparing model... (~1min)';
  }
  &.ready::before {
    content: '🔵 Model is ready';
  }
  &.generating-response::before {
    content: '🖊️ Generating response...';
  }
  &.error::before {
    content: '❌ Error while preparing or running the model';
  }
}

/* REVIEW HELPER STATUS */

#reviewHelperStatusWrapper {
  font-style: italic;
  background-color: rgb(from var(--color) r g b / 25%);
  transition: var(--background-color-transition-default);
  &.not-started, &.preparing {
    --color: var(--neutral-color);
  }
  &.ready {
    --color: var(--primary-color);
  }
  &.generating-response {
    --color: var(--ai-color);
  }
  &.error {
    --color: var(--error-color);
  }
}

#reviewHelperStatus {
  color: var(--color);
  &.not-started::before {
    content: 'Review helper is not ready yet.';
  }
  &.preparing::before {
    content: 'Review helper getting ready... (~1min)';
  }
  &.ready::before {
    content: 'Review helper is ready.';
  }
  &.generating-response::before {
    content: 'Thinking...';
  }
  &.error::before {
    content: 'Error';
  }
}

/* REVIEW HELPER BUBBLE WRAPPER */

#reviewHelperBubble {
  &.hidden {
    display: none;
  }
  animation: opacity 0.2s ease forwards;
  opacity: 0;
  box-shadow: var(--box-shadow-default);
  border-radius: 0.25rem;
  flex-direction: column;
  justify-content: space-between;
  width: 10rem;
  height: 7.5rem;
  box-sizing: border-box;
  padding: 0.5rem;
  font-size: smaller;
  display: flex;
  position: absolute;
  top: -3.75rem;
  right: -11rem;
}

/* REVIEW HELPER BUBBLE CONTENT */

#reviewHelperOutput {
  margin-bottom: 1.8rem;
  padding: 0;
  overflow: scroll;
  box-sizing: border-box;
}

#reviewHelperStatusWrapper {
  height: 2.2rem;
  padding: 0.2rem 0.3rem;
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
}

/* AI EFFECT */

.ai-effect-wrapper {
  background: white;
  --size: 26px;
  width: var(--size);
  height: var(--size);
  position: absolute;
  top: -0.6rem;
  right: -0.8rem;
  display: flex;
  border-radius: 10rem;
  padding: 0.1rem;
  box-shadow: var(--box-shadow-default);
  transition: var(--background-color-transition-default);
  cursor: pointer;
  &:hover {
    background-color: var(--primary-color-x-light);
    box-shadow: var(--box-shadow-default);
  }
}

#aiEffect {
  --size: 26px;
  --mask-size: calc(var(--size) / 2);

  inline-size: var(--size);
  mask: radial-gradient(
      closest-side,
      #0000 calc(100% - 0.5px),
      red calc(100% + 0.5px)
    )
    calc(-0.5 * var(--size)) calc(-0.5 * var(--size));

  &.not-started,
  &.preparing,
  &.error {
    background: linear-gradient(to top right, black, whitesmoke);
  }

  &.preparing {
    animation: 2s infinite pulse cubic-bezier(0.4, 0, 1, 1);
  }

  &.ready {
    animation: rotate 1s ease;
    background: linear-gradient(
      to top right in oklch,
      oklch(70% 0.5 340),
      oklch(90% 0.5 200)
    );
  }

  &.generating-response {
    animation: 0.8s infinite pulse cubic-bezier(0.4, 0, 1, 1);
    background: linear-gradient(
      to top right in oklch,
      oklch(70% 0.5 340),
      oklch(90% 0.5 200)
    );
  }
}
