[data-component="assistant-message"] {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

[data-component="user-message"] {
  font-family: var(--font-family-sans);
  font-size: var(--font-size-base);
  font-style: normal;
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-large);
  letter-spacing: var(--letter-spacing-normal);
  color: var(--text-base);
  display: flex;
  flex-direction: column;
  gap: 8px;

  [data-slot="user-message-attachments"] {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  [data-slot="user-message-attachment"] {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    overflow: hidden;
    background: var(--surface-base);
    border: 1px solid var(--border-base);
    transition: border-color 0.15s ease;

    &:hover {
      border-color: var(--border-strong-base);
    }

    &[data-type="image"] {
      width: 48px;
      height: 48px;
    }

    &[data-type="file"] {
      width: 48px;
      height: 48px;
    }
  }

  [data-slot="user-message-attachment-image"] {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  [data-slot="user-message-attachment-icon"] {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--icon-weak);

    [data-component="icon"] {
      width: 20px;
      height: 20px;
    }
  }

  [data-slot="user-message-text"] {
    display: -webkit-box;
    white-space: pre-wrap;
    line-clamp: 3;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    background: var(--surface-inset-base);
    padding: 2px 6px;
    border-radius: 4px;
    border: 0.5px solid var(--border-weak-base);
  }

  .text-text-strong {
    color: var(--text-strong);
  }

  .font-medium {
    font-weight: var(--font-weight-medium);
  }
}

[data-component="text-part"] {
  width: 100%;

  [data-component="markdown"] {
    margin-top: 32px;
    font-size: var(--font-size-base);
  }
}

[data-component="reasoning-part"] {
  width: 100%;
  opacity: 0.5;

  [data-component="markdown"] {
    margin-top: 24px;
    font-style: italic !important;
  }
}

[data-component="tool-error"] {
  display: flex;
  align-items: start;
  gap: 8px;

  [data-slot="icon-svg"] {
    color: var(--icon-critical-base);
    margin-top: 4px;
  }

  [data-slot="message-part-tool-error-content"] {
    display: flex;
    align-items: start;
    gap: 8px;
  }

  [data-slot="message-part-tool-error-title"] {
    font-family: var(--font-family-sans);
    font-size: var(--font-size-base);
    font-style: normal;
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-large);
    letter-spacing: var(--letter-spacing-normal);
    color: var(--text-on-critical-base);
    white-space: nowrap;
  }

  [data-slot="message-part-tool-error-message"] {
    color: var(--text-on-critical-weak);
  }
}

[data-component="tool-output"] {
  white-space: pre;
  padding: 8px 12px;
  height: fit-content;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;

  pre {
    margin: 0;
    padding: 0;
  }

  &[data-scrollable] {
    height: auto;
    max-height: 240px;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;

    &::-webkit-scrollbar {
      display: none;
    }

    [data-component="markdown"] {
      overflow: visible;
    }
  }
}

[data-component="edit-trigger"],
[data-component="write-trigger"] {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;

  [data-slot="message-part-title-area"] {
    flex-grow: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }

  [data-slot="message-part-title"] {
    flex-shrink: 0;
    font-family: var(--font-family-sans);
    font-size: var(--font-size-base);
    font-style: normal;
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-large);
    letter-spacing: var(--letter-spacing-normal);
    color: var(--text-base);
    text-transform: capitalize;
  }

  [data-slot="message-part-path"] {
    display: flex;
    flex-grow: 1;
    min-width: 0;
  }

  [data-slot="message-part-directory"] {
    color: var(--text-weak);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    direction: rtl;
    text-align: left;
  }

  [data-slot="message-part-filename"] {
    color: var(--text-strong);
    flex-shrink: 0;
  }

  [data-slot="message-part-actions"] {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: flex-end;
  }
}

[data-component="edit-content"] {
  border-top: 1px solid var(--border-weaker-base);
}

[data-component="write-content"] {
  border-top: 1px solid var(--border-weaker-base);
  max-height: 240px;
  overflow-y: auto;

  [data-component="code"] {
    padding-bottom: 0px !important;
  }

  /* Hide scrollbar */
  scrollbar-width: none;
  -ms-overflow-style: none;
  &::-webkit-scrollbar {
    display: none;
  }
}

[data-component="tool-action"] {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

[data-component="todos"] {
  padding: 10px 12px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 8px;

  [data-slot="message-part-todo-content"] {
    &[data-completed="completed"] {
      text-decoration: line-through;
      color: var(--text-weaker);
    }
  }
}
