:host {
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6rem 0rem;
  padding-top: 3rem;
  overflow-y: auto;
}

@keyframes dot-flashing {
  0% {
    opacity: 0.2;
  }
  100% {
    opacity: 0.8;
  }
}

.awaiting-connection {
  margin: 0 auto;
  color: #d1d1d1;
}

.chat-messages {
  height: auto;
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;

  .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--gray-400);
    text-align: center;

    p {
      font-size: 1rem;
      margin-top: 0.5rem;
    }
  }

  .message-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 80%;

    &.message-user {
      align-self: flex-end;

      .message-role {
        align-self: flex-end;
      }

      .message-content {
        background-color: var(--accent-color);
        border-radius: 12px 12px 0 12px;
        color: white;
      }

      .timestamp {
        align-self: flex-end;
      }
    }

    &.message-assistant {
      align-self: flex-start;

      .message-content {
        background-color: #151515;
        border-radius: 12px 12px 12px 0;
      }
    }
  }

  .message-role {
    font-size: 0.875rem;
    color: var(--gray-400);
    margin-bottom: 0.25rem;
  }

  .message-content {
    padding: 0.75rem 1rem;
    overflow-wrap: break-word;
  }

  .message-item {
    &:not(:last-child) {
      margin-bottom: 0.5rem;
    }
  }

  .message-text {
    line-height: 1.5;
  }

  .tool-call {
    .tool-call-name {
      font-weight: 500;
      margin-bottom: 0.5rem;
      display: flex;
      align-items: center;
      gap: 0.5rem;

      .loading-dots {
        display: inline-flex;
        align-items: center;

        span {
          width: 6px;
          height: 6px;
          margin: 0 2px;
          background-color: currentColor;
          border-radius: 50%;
          display: inline-block;
          opacity: 0.6;

          &:nth-child(1) {
            animation: dot-flashing 1s infinite alternate 0s;
          }

          &:nth-child(2) {
            animation: dot-flashing 1s infinite alternate 0.3s;
          }

          &:nth-child(3) {
            animation: dot-flashing 1s infinite alternate 0.6s;
          }
        }
      }
    }
  }

  .tool-arguments,
  .tool-response {
    .tool-arguments-header,
    .tool-response-header {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      cursor: pointer;
      padding: 0.25rem 0;
      font-weight: 400;

      i {
        font-size: 10px;
        transition: transform 0.2s ease;

        &.expanded {
          transform: rotate(90deg);
        }
      }

      &:hover {
        opacity: 0.8;
      }
    }

    .tool-arguments-content,
    .tool-response-content {
      margin-top: 0.5rem;
      padding: 0.5rem;
      background-color: rgba(0, 0, 0, 0.1);
      border-radius: 4px;
      font-family: monospace;
      white-space: pre-wrap;
    }
  }

  .inaudible {
    font-style: italic;
    opacity: 0.7;
  }

  .awaiting-transcript {
    font-style: italic;
    opacity: 0.7;
  }

  .timestamp {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
  }
}
